Mirra
Get Started

Quickstart

Mirra enables you to build and deploy AI agents, serverless scripts, and API integrations. This guide walks you through creating your first script in under five minutes.

Prerequisites

Before you begin, ensure you have:

That's it! For the UI-based approach, you can get started immediately. If you want to use the REST API, you'll also need an API key (see API Authentication below).

Create your first script (UI)

The easiest way to create a script is through the browser-based interface:

  1. Navigate to the Developer Dashboard

    Visit https://store.getmirra.app/developer/scripts and sign in with your Mirra account.

  2. Click "Create New Script"

    This opens a guided 4-step wizard that walks you through the entire process.

  3. Add basic information (Step 1)

    • Name: Give your script a descriptive name
    • Description: Explain what your script does
    • Runtime: Choose Node.js 18 or Python 3.11
    • Category: Select the most appropriate category
    • Private: Toggle on if you want the script for personal use only
  4. Write your code (Step 2)

    The built-in Monaco editor provides syntax highlighting and autocomplete. A starter template is provided based on your chosen runtime:

    Node.js example:

    async function main(params) {
      return {
        success: true,
        message: 'Hello from your script!',
        input: params
      };
    }
     
    module.exports = { main };

    Python example:

    def main(params):
        return {
            'success': True,
            'message': 'Hello from your script!',
            'input': params
        }
  5. Configure resource permissions (Step 3)

    Select which integrations your script can access (Telegram, Gmail, Calendar, etc.). The UI auto-detects resources referenced in your code.

  6. Set up automation (Step 4)

    Configure how your script can be triggered (events, manual, scheduled), define user-facing variables, and set pricing if you're publishing to the marketplace.

  7. Deploy

    Click "Create Script" and your script is instantly deployed and ready to use!

The UI automatically handles deployment, configuration, and makes your script available immediately.

Create your first script (API)

For programmatic workflows and CI/CD pipelines, you can also create scripts via the REST API.

API Authentication

To use the API, you need an API key. API keys are automatically generated when you create a script.

Getting your first API key:

The easiest way to get an API key is to create a script via the web interface:

  1. Navigate to https://store.getmirra.app/developer/scripts and sign in
  2. Click Create New Script
  3. Complete the creation wizard
  4. Copy your API key from the success screen—it will only be shown once

Alternatively, if you already have a session token from logging into Mirra, you can create a script via the API (see Create a script via API below), which will return an API key.

Store your API key securely. It provides full access to your scripts and resources via the API. Never commit API keys to version control or expose them in client-side code.

See the Authentication guide for detailed information about API keys, how they're generated, and security best practices.

Create a script via API

Create a script by sending a POST request to the scripts endpoint. Note that you need a session token (obtained by logging into Mirra) to create your first script, which will return an API key:

curl https://api.fxn.world/api/sdk/v1/scripts \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My First Script",
    "description": "A simple echo script that returns the input",
    "runtime": "nodejs18",
    "category": "utility",
    "code": "async function main(params) { return { success: true, input: params }; } module.exports = { main };",
    "isPrivate": false,
    "config": {
      "timeout": 30,
      "memory": 256
    },
    "pricing": {
      "model": "free"
    }
  }'

Response:

{
  "success": true,
  "data": {
    "id": "673abc123def456789",
    "name": "My First Script",
    "description": "A simple echo script that returns the input",
    "runtime": "nodejs18",
    "status": "active",
    "apiKey": "mirra_script_a1b2c3d4e5f6789abcdef0123456789abcdef0123456789abcdef0123456789",
    "createdAt": "2025-11-19T12:00:00Z"
  }
}

The apiKey field in the response is your authentication credential for this script. Store it securely—it will only be shown once. You can now use this API key for subsequent API requests.

Your script is now deployed and ready to execute!

Using client libraries (API)

While the Mirra SDK is a REST API accessible via any HTTP client, official client libraries provide type safety and convenience for Node.js and Python applications.

Node.js / TypeScript

Install the Node.js client library:

npm install @mirra-messenger/sdk

Create a script using the client library:

import { MirraSDK } from '@mirra-messenger/sdk';
 
const mirra = new MirraSDK({ apiKey: 'YOUR_API_KEY' });
 
const script = await mirra.scripts.create({
  name: 'My Script',
  description: 'A helpful automation script',
  runtime: 'nodejs18',
  code: 'async function main(params) { return { success: true, input: params }; } module.exports = { main };',
  category: 'automation',
  config: {
    timeout: 30,
    memory: 256
  },
  pricing: {
    model: 'free'
  }
});

Python

Install the Python client library:

pip install mirra-sdk

Create a script using the Python client:

from mirra import MirraSDK
 
mirra = MirraSDK(api_key="YOUR_API_KEY")
 
script = mirra.scripts.create(
    name="My Script",
    description="A helpful automation script",
    runtime="python3.11",
    code="def main(params):\n    return {'success': True, 'input': params}",
    category="automation",
    config={
        "timeout": 30,
        "memory": 256
    },
    pricing={
        "model": "free"
    }
)

Troubleshooting

401 Unauthorized

Your API key is missing or invalid.

Check that:

  • You include the Authorization: Bearer YOUR_API_KEY header in every request
  • Your API key is correct and starts with mirra_script_ or mirra_install_
  • The script associated with the API key is still active

See Authentication for more details.

400 Validation Error

Your request data failed validation.

Example error response:

{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "subdomain must be between 3 and 30 characters",
    "details": {
      "field": "subdomain"
    }
  }
}

The details object indicates which field caused the validation error. Verify that all required fields are present and meet the documented constraints.

409 Conflict

The resource already exists (typically a naming conflict).

Example error response:

{
  "success": false,
  "error": {
    "code": "RESOURCE_EXISTS",
    "message": "A script with this name already exists"
  }
}

Choose a different name or verify that you do not already own the resource.

See the Error Codes reference for a complete list of error codes and handling strategies.

Next steps

Now that you have created your first script, explore more features:

  • Browse the Mirra Store - Discover and install scripts created by the community
  • Scripts Documentation - Learn about event-driven automation, triggers, and advanced features
  • Resources - Create and publish API integrations
  • Templates - Bundle scripts and resources into installable templates
  • Agents - Build AI agents with custom tools and integrations
  • Authentication - API key management and security best practices
  • Error Codes - Complete error reference and handling patterns

On this page