Mirra
Mirra APIResources

Resource Endpoints

This page documents all available operations for creating, managing, and using resources on the Mirra platform.

Create Resource

Create a new resource with API endpoint configuration and OpenAPI specification.

Endpoint

POST /api/sdk/v1/resources

Request Body

{
  "name": "Crypto Price API",
  "description": "Real-time cryptocurrency prices",
  "resourceType": "api",
  "category": "crypto",
  "tags": ["crypto", "prices", "trading"],
  "openApiSpec": { /* OpenAPI 3.0 specification */ },
  "endpoint": {
    "baseUrl": "https://api.crypto-prices.com",
    "authentication": "api_key",
    "methods": [ /* Method definitions */ ]
  },
  "pricing": {
    "model": "pay-per-call",
    "basePrice": 0.001,
    "currency": "USDC"
  }
}

Response

{
  "success": true,
  "data": {
    "id": "resource_abc123",
    "name": "Crypto Price API",
    "resourceType": "api",
    "status": "draft",
    "createdAt": "2025-11-15T12:00:00Z"
  }
}

The resource is created in draft status and must be published before it appears in the marketplace.


Install Resource

Install a resource to your account before invoking methods. Installation creates an installation record and prepares the resource for authentication.

Endpoint

POST /api/sdk/v1/resources/{resourceId}/install

Response

{
  "success": true,
  "data": {
    "installationId": "inst_789",
    "resourceId": "resource_123",
    "userId": "user_456",
    "isAuthenticated": false,
    "status": "active",
    "installedAt": "2025-11-05T12:00:00Z"
  }
}

The isAuthenticated field indicates whether the user has provided credentials. Resources requiring authentication must be authenticated before use.


Authenticate Resource

Provide credentials for resources requiring authentication. The platform securely stores credentials and injects them into API requests.

Endpoint

POST /api/sdk/v1/resources/{resourceId}/authenticate

Request Body

API Key
{
  "type": "api_key",
  "credentials": {
    "apiKey": "sk_live_..."
  }
}
OAuth 2.0
{
  "type": "oauth2",
  "credentials": {
    "accessToken": "ya29.a0...",
    "refreshToken": "1//0g...",
    "expiresAt": "2025-11-05T13:00:00Z"
  }
}
Basic Auth
{
  "type": "basic",
  "credentials": {
    "username": "user@example.com",
    "password": "password123"
  }
}
Bearer Token
{
  "type": "bearer",
  "credentials": {
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
  }
}

Get Installation Usage

Track usage metrics and costs for a specific resource installation.

Endpoint

GET /api/sdk/v1/resources/installations/{installationId}/usage

Response

{
  "success": true,
  "data": {
    "totalCalls": 547,
    "totalCost": 0.547,
    "callsToday": 23,
    "lastUsedAt": "2025-11-05T11:45:00Z",
    "recentCalls": [
      {
        "timestamp": "2025-11-05T11:45:00Z",
        "method": "getPrice",
        "cost": 0.001,
        "duration": 234,
        "success": true
      }
    ]
  }
}

Get Resource Metrics

View aggregated metrics across all users for a resource you created. Available to resource creators only.

Endpoint

GET /api/sdk/v1/resources/{resourceId}/metrics

Response

{
  "success": true,
  "data": {
    "totalUsers": 156,
    "totalCalls": 45678,
    "totalRevenue": 45.678,
    "rating": 4.7,
    "reviewCount": 34
  }
}

Publish Resource

Publish a resource to the marketplace to make it available for installation. Publishing validates the resource configuration.

Endpoint

POST /api/sdk/v1/resources/{resourceId}/publish

Publishing Requirements

  • Valid name and description
  • At least one method defined
  • Valid OpenAPI 3.0 specification
  • All method schemas validated

Response

{
  "success": true,
  "data": {
    "id": "resource_abc123",
    "status": "published",
    "publishedAt": "2025-11-15T12:00:00Z"
  }
}

Unpublish Resource

Remove a resource from the marketplace. Unpublishing prevents new installations but does not affect existing installations.

Endpoint

POST /api/sdk/v1/resources/{resourceId}/unpublish

Response

{
  "success": true,
  "data": {
    "id": "resource_abc123",
    "status": "draft"
  }
}

Update Resource

Update resource configuration, methods, or pricing. Updates do not affect existing installations until users upgrade.

Endpoint

PATCH /api/sdk/v1/resources/{resourceId}

Request Body

{
  "description": "Updated description",
  "pricing": {
    "model": "subscription",
    "basePrice": 10.0
  }
}

Delete Resource

Permanently delete a resource. Resources with active installations cannot be deleted.

Endpoint

DELETE /api/sdk/v1/resources/{resourceId}

Response

{
  "success": true,
  "message": "Resource deleted successfully"
}

List Marketplace Resources

Browse available resources in the marketplace with filtering and pagination.

Endpoint

GET /api/sdk/v1/resources/marketplace

Query Parameters

  • category (string, optional) - Filter by category
  • tags (string[], optional) - Filter by tags
  • search (string, optional) - Search by name or description
  • limit (number, optional) - Results per page (default: 10)
  • offset (number, optional) - Pagination offset (default: 0)

Response

{
  "success": true,
  "data": {
    "resources": [
      {
        "id": "resource_123",
        "name": "Crypto Price API",
        "description": "Real-time cryptocurrency prices",
        "resourceType": "api",
        "category": "crypto",
        "pricing": {
          "model": "pay-per-call",
          "basePrice": 0.001
        },
        "rating": 4.8,
        "installCount": 234
      }
    ],
    "total": 150,
    "limit": 10,
    "offset": 0
  }
}

List User Installations

Get all resources installed to your account.

Endpoint

GET /api/sdk/v1/resources/installations

Response

{
  "success": true,
  "data": {
    "installations": [
      {
        "installationId": "inst_123",
        "resourceId": "resource_456",
        "resourceName": "Crypto Price API",
        "isAuthenticated": true,
        "installedAt": "2025-11-01T10:00:00Z",
        "lastUsedAt": "2025-11-05T11:45:00Z"
      }
    ]
  }
}

Uninstall Resource

Remove a resource installation from your account. This removes credentials and prevents future method calls.

Endpoint

DELETE /api/sdk/v1/resources/{resourceId}/install

Response

{
  "success": true,
  "message": "Resource uninstalled successfully"
}

Note: Uninstalling a resource does not refund subscription fees or usage charges.


See Also

On this page