Cloud World Model API Key Self-Service API

Bootstrap and self-service path for obtaining API keys without direct database access. ## Onboarding Flow for External Clients (e.g. Canvas Cloud AI) 1. **Platform operator** runs the bootstrap script once: ``` npx tsx scripts/bootstrap-admin-key.ts ``` This prints a one-time admin key. Store it as a secret immediately. 2. **Admin** mints a scoped, time-limited registration token for the external client: ```http POST /register-tokens Authorization: Bearer Content-Type: application/json { "name": "canvas-cloud-ai", "scopes": ["read","write"], "expiresAt": "2026-06-01T00:00:00Z" } ``` 3. **External client** exchanges the token once (manually or via a one-off script): ```http POST /keys/register Content-Type: application/json { "token": "", "name": "canvas-cloud-ai-prod" } ``` The response contains a permanent API key. Store it as an environment secret. 4. The token is **burned on use** and can never be reused. All subsequent API calls use the permanent key directly.

GitHub OpenAPI

Operations 4

POST /keys/register Exchange a registration token for a permanent API key #
POST /register-tokens Mint a new registration token (admin) #
GET /register-tokens List all registration tokens (admin) #
DELETE /register-tokens/{id} Revoke an unused registration token (admin) #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/cloudworldmodel-ai:cloudworldmodel-ai-api-key-self-service-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

cloudworldmodel-ai-api-key-self-service-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Cloudworldmodel Ai API Key Self-Service API
  version: 1.0.0
  contact:
    name: Cloud World Model API Support
    url: https://www.cloudworldmodel.ai
    email: api@cloudworldmodel.ai
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  description: 'Operations tagged API Key Self-Service across 2 of this provider''s published API definitions: cloudworldmodel-ai-openapi.json, cloudworldmodel-ai-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: https://www.cloudworldmodel.ai/api
  description: Production
- url: http://localhost:5000/api
  description: Local development
security: []
tags:
- name: API Key Self-Service
  description: 'Bootstrap and self-service path for obtaining API keys without direct database access.


    ## Onboarding Flow for External Clients (e.g. Canvas Cloud AI)


    1. **Platform operator** runs the bootstrap script once:

    ```

    npx tsx scripts/bootstrap-admin-key.ts

    ```

    This prints a one-time admin key. Store it as a secret immediately.


    2. **Admin** mints a scoped, time-limited registration token for the external client:

    ```http

    POST /register-tokens

    Authorization: Bearer

    Content-Type: application/json

    { "name": "canvas-cloud-ai", "scopes": ["read","write"], "expiresAt": "2026-06-01T00:00:00Z" }

    ```


    3. **External client** exchanges the token once (manually or via a one-off script):

    ```http

    POST /keys/register

    Content-Type: application/json

    { "token": "", "name": "canvas-cloud-ai-prod" }

    ```

    The response contains a permanent API key. Store it as an environment secret.


    4. The token is **burned on use** and can never be reused.

    All subsequent API calls use the permanent key directly.'
paths:
  /keys/register:
    x-stability: stable
    post:
      tags:
      - API Key Self-Service
      summary: Exchange a registration token for a permanent API key
      description: 'Public endpoint — no authentication required.


        Accepts a single-use registration token minted by an admin via `POST /register-tokens`

        and returns a permanent API key pre-scoped to whatever the admin specified when the

        token was created.


        **The token is burned immediately on success.** It cannot be reused even if the caller

        loses the returned key — in that case the admin must mint a new token.


        **Intended usage pattern (Canvas Cloud AI / external agents):**

        1. Admin mints a registration token (expiry set for safety).

        2. Client calls this endpoint once to receive its permanent key.

        3. Client stores the key as an environment secret (`CWM_API_KEY`).

        4. All subsequent API calls use that key directly — no runtime token exchange ever occurs.'
      operationId: registerApiKey
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - token
              - name
              properties:
                token:
                  type: string
                  description: The registration token received from the platform admin (starts with `cwm_reg_`)
                  example: cwm_reg_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2
                name:
                  type: string
                  description: A descriptive name for the API key that will be created
                  example: canvas-cloud-ai-prod
            example:
              token: cwm_reg_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2
              name: canvas-cloud-ai-prod
      responses:
        '201':
          description: API key created successfully. Store the `key` field immediately — it will not be shown again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyCreatedResponse'
              example:
                id: 3f9a1b2c-4d5e-6f7a-8b9c-0d1e2f3a4b5c
                key: cwm_live_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2
                keyPrefix: cwm_live_a1b2c3d4e5f6a1b2...
                name: canvas-cloud-ai-prod
                scopes:
                - read
                - write
                rateLimit: 1000
                createdAt: '2026-05-10T17:00:00.000Z'
                message: Store this API key securely. You won't be able to see it again.
        '400':
          description: Invalid request body or token format
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Registration token not found or HMAC mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '410':
          description: Registration token is expired, revoked, or already used
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          $ref: '#/components/responses/InternalError'
    servers:
    - url: https://www.cloudworldmodel.ai/api
      description: Production
    - url: http://localhost:5000/api
      description: Local development
  /register-tokens:
    x-stability: stable
    post:
      tags:
      - API Key Self-Service
      summary: Mint a new registration token (admin)
      description: 'Requires `admin` scope. Creates a named, scoped, time-limited single-use invite token.

        The plain token is returned **once** in the response and must be shared with the intended

        client immediately — it cannot be retrieved again.


        The client uses the token at `POST /keys/register` to exchange it for a permanent API key.'
      operationId: createRegistrationToken
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - name
              properties:
                name:
                  type: string
                  description: Human-readable label identifying the intended token recipient
                  example: canvas-cloud-ai
                scopes:
                  type: array
                  items:
                    type: string
                    enum:
                    - read
                    - write
                    - admin
                  default:
                  - read
                  - write
                  description: Scopes that the resulting API key will have
                rateLimit:
                  type: integer
                  default: 1000
                  description: Requests-per-hour limit on the resulting API key
                expiresAt:
                  type: string
                  format: date-time
                  description: Optional ISO 8601 expiry for the registration token. If omitted, the token never expires.
                  example: '2026-06-01T00:00:00Z'
            example:
              name: canvas-cloud-ai
              scopes:
              - read
              - write
              rateLimit: 1000
              expiresAt: '2026-06-01T00:00:00Z'
      responses:
        '201':
          description: Registration token created. The `token` field is shown once — share it with the recipient now.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RegistrationTokenCreatedResponse'
              example:
                id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
                token: cwm_reg_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2
                tokenPrefix: cwm_reg_a1b2c3d4e5f6a1b2...
                name: canvas-cloud-ai
                scopes:
                - read
                - write
                rateLimit: 1000
                expiresAt: '2026-06-01T00:00:00Z'
                createdAt: '2026-05-10T17:00:00.000Z'
                message: Share this token with the client. It can only be used once and will not be shown again.
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/ApiKeyUnauthorized'
        '403':
          description: Insufficient scope — admin required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          $ref: '#/components/responses/InternalError'
    get:
      tags:
      - API Key Self-Service
      summary: List all registration tokens (admin)
      description: 'Requires `admin` scope. Returns all registration tokens including their status:

        `pending` (unused and not expired), `used`, `expired`, or `revoked`.

        The plain token value is never returned in list responses.'
      operationId: listRegistrationTokens
      security: []
      responses:
        '200':
          description: List of all registration tokens
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RegistrationTokenSummary'
        '401':
          $ref: '#/components/responses/ApiKeyUnauthorized'
        '403':
          description: Insufficient scope — admin required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          $ref: '#/components/responses/InternalError'
    servers:
    - url: https://www.cloudworldmodel.ai/api
      description: Production
    - url: http://localhost:5000/api
      description: Local development
  /register-tokens/{id}:
    x-stability: stable
    delete:
      tags:
      - API Key Self-Service
      summary: Revoke an unused registration token (admin)
      description: 'Requires `admin` scope. Marks an unused, pending token as revoked so it can no longer

        be exchanged. Returns `409 Conflict` if the token has already been used (the resulting

        API key must be revoked separately via `DELETE /keys/{id}`).'
      operationId: revokeRegistrationToken
      security: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: The registration token ID returned when the token was created
        example: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
      responses:
        '200':
          description: Token revoked successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Registration token revoked successfully
        '401':
          $ref: '#/components/responses/ApiKeyUnauthorized'
        '403':
          description: Insufficient scope — admin required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: Token has already been used and cannot be revoked
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Cannot revoke a token that has already been used
        '500':
          $ref: '#/components/responses/InternalError'
    servers:
    - url: https://www.cloudworldmodel.ai/api
      description: Production
    - url: http://localhost:5000/api
      description: Local development
components:
  schemas:
    FieldError:
      type: object
      description: A single structured field-level error returned on HTTP 400 responses
      required:
      - code
      - pointer
      - message
      properties:
        code:
          $ref: '#/components/schemas/ValidationErrorCode'
        pointer:
          type: string
          description: JSON Pointer (RFC 6901) to the field that caused the error, or an empty string for request-level errors
          example: /resources/0/provider
        message:
          type: string
          description: Human-readable description of the error
          example: Unknown provider 'gce'; valid values are aws, gcp, azure, oci, digitalocean
        suggestion:
          type: string
          description: Optional actionable hint for self-correction
          example: 'Use one of: aws, gcp, azure, oci, digitalocean'
        suggestions:
          type: array
          description: For UNKNOWN_REGION errors, the 3-5 closest matching regions ranked by similarity to the invalid input
          items:
            type: object
            required:
            - regionKey
            - regionLabel
            properties:
              regionKey:
                type: string
                description: Canonical shortcode for the region
                example: use2
              regionLabel:
                type: string
                description: Standard provider label for the region
                example: us-east-2
    ValidationErrorCode:
      type: string
      description: Machine-readable error code indicating the category of validation failure
      enum:
      - INVALID_FIELD
      - MISSING_REQUIRED
      - UNKNOWN_PROVIDER
      - UNKNOWN_SIZE
      - UNKNOWN_REGION
      - INVALID_REQUEST
    RegistrationTokenCreatedResponse:
      type: object
      description: Response returned when a registration token is minted. The plain `token` value is shown only once.
      properties:
        id:
          type: string
          description: Unique identifier for the registration token
          example: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
        token:
          type: string
          description: The plain-text registration token. Share this with the recipient immediately — it will not be shown again.
          example: cwm_reg_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2
        tokenPrefix:
          type: string
          description: Redacted prefix used to identify the token in listings
          example: cwm_reg_a1b2c3d4e5f6a1b2...
        name:
          type: string
          example: canvas-cloud-ai
        scopes:
          type: array
          items:
            type: string
            enum:
            - read
            - write
            - admin
          example:
          - read
          - write
        rateLimit:
          type: integer
          example: 1000
        expiresAt:
          type: string
          format: date-time
          nullable: true
          example: '2026-06-01T00:00:00Z'
        createdAt:
          type: string
          format: date-time
          example: '2026-05-10T17:00:00.000Z'
        message:
          type: string
          example: Share this token with the client. It can only be used once and will not be shown again.
    ApiKeyAuth401Response:
      type: object
      description: 'Structured 401 returned by API-key-protected endpoints when no

        credentials are provided at all. Includes a machine-readable `apiKeyAuth`

        block so cold agents can discover how to create an API key without

        consulting the spec first.

        '
      required:
      - error
      - message
      - apiKeyAuth
      properties:
        error:
          type: string
          enum:
          - authentication_required
          description: Machine-readable error code
          example: authentication_required
        message:
          type: string
          description: Human-readable description
          example: Provide an API key in the Authorization header.
        apiKeyAuth:
          type: object
          description: Discovery hints for obtaining an API key
          required:
          - keyCreationEndpoint
          - docsUrl
          - next
          properties:
            keyCreationEndpoint:
              type: string
              description: Path to create a new API key
              example: /keys/register
            docsUrl:
              type: string
              description: Path to API documentation
              example: /api-docs
            next:
              type: object
              description: Machine-readable pointer to the first step to get an API key
              required:
              - method
              - path
              properties:
                method:
                  type: string
                  enum:
                  - POST
                  example: POST
                path:
                  type: string
                  example: /keys/register
    ApiKeyCreatedResponse:
      type: object
      description: Response returned when an API key is successfully created (either via admin POST /keys or via POST /keys/register)
      properties:
        id:
          type: string
          description: Unique identifier for the created API key
          example: 3f9a1b2c-4d5e-6f7a-8b9c-0d1e2f3a4b5c
        key:
          type: string
          description: The plain-text API key. Store this immediately — it is shown only once.
          example: cwm_live_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2
        keyPrefix:
          type: string
          description: Redacted prefix used to identify the key in listings
          example: cwm_live_a1b2c3d4e5f6a1b2...
        name:
          type: string
          example: canvas-cloud-ai-prod
        scopes:
          type: array
          items:
            type: string
            enum:
            - read
            - write
            - admin
          example:
          - read
          - write
        rateLimit:
          type: integer
          example: 1000
        createdAt:
          type: string
          format: date-time
          example: '2026-05-10T17:00:00.000Z'
        expiresAt:
          type: string
          format: date-time
          nullable: true
        message:
          type: string
          example: Store this API key securely. You won't be able to see it again.
    ValidationErrorResponse:
      type: object
      description: Response body for HTTP 400 errors — either a single error or an array of field errors
      oneOf:
      - type: object
        required:
        - error
        properties:
          error:
            $ref: '#/components/schemas/FieldError'
      - type: object
        required:
        - errors
        properties:
          errors:
            type: array
            items:
              $ref: '#/components/schemas/FieldError'
            minItems: 1
    RegistrationTokenSummary:
      type: object
      description: Summary of a registration token as returned by GET /register-tokens (plain token value is never included)
      properties:
        id:
          type: string
          example: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
        tokenPrefix:
          type: string
          example: cwm_reg_a1b2c3d4e5f6a1b2...
        name:
          type: string
          example: canvas-cloud-ai
        scopes:
          type: array
          items:
            type: string
            enum:
            - read
            - write
            - admin
          example:
          - read
          - write
        rateLimit:
          type: integer
          example: 1000
        expiresAt:
          type: string
          format: date-time
          nullable: true
          example: '2026-06-01T00:00:00Z'
        usedAt:
          type: string
          format: date-time
          nullable: true
          description: Set when the token was consumed. Null if still pending.
        isActive:
          type: boolean
          example: true
        createdByKeyId:
          type: string
          description: ID of the admin API key that created this token
          example: 1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d
        createdAt:
          type: string
          format: date-time
          example: '2026-05-10T17:00:00.000Z'
        status:
          type: string
          enum:
          - pending
          - used
          - expired
          - revoked
          description: Computed status of the token
          example: pending
    Error:
      type: object
      required:
      - error
      properties:
        error:
          type: string
          description: Error message
          example: Simulation not found
        details:
          type: array
          description: Detailed validation errors (for 400 responses)
          items:
            type: object
  responses:
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ApiKeyUnauthorized:
      description: 'No credentials provided to an API-key-protected endpoint. The response

        body includes a machine-readable `apiKeyAuth` block pointing to the key

        creation endpoint so agents can self-serve an API key without consulting

        the spec.

        '
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiKeyAuth401Response'
    BadRequest:
      description: Invalid request data — structured field-level error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationErrorResponse'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key or Wallet Session JWT
      description: 'API key or wallet-session JWT authentication using Bearer tokens in the Authorization header.


        **How to authenticate:**

        1. Create an API key using POST /api/keys

        2. Include the key in the Authorization header: `Bearer cwm_live_<your_key>`

        3. All RL environment endpoints require authentication


        **Rate Limits:**

        - Default: 1000 requests/hour per key

        - Configurable per key

        - Returns 429 when exceeded

        '
    UiSessionCookie:
      type: apiKey
      in: cookie
      name: cwm_ui_session
      description: 'HttpOnly browser-workspace session cookie issued by

        `POST /api/ui/simulations`. It authorizes UI mutations for simulations

        owned by that browser workspace.

        '
    x402:
      type: apiKey
      in: header
      name: X-PAYMENT
      description: "x402 v2 Base micropayment option. Select the Base entry from\n`GET /api/billing/x402/config` `paymentOptions`, then send its signed USDC\nmicro-payment in the `X-PAYMENT` header to get full access to the metered\nendpoint in a single round-trip — no account, no API key, no sign-up required.\n\n**402 → pay → retry loop:**\n1. Call the endpoint without an `X-PAYMENT` header.\n2. Receive a `402 Payment Required` response. The body is a\n   standard JSON `PaymentRequired` object. The same payload is also\n   echoed as a base64-encoded string in the `PAYMENT-REQUIRED`\n   response header for clients that cannot access the body.\n3. Decode the `PaymentRequired` body (or the `PAYMENT-REQUIRED`\n   header) to read the exact `payTo` wallet,\n   USDC amount, network, and facilitator URL.\n4. Construct and sign the payment with your x402 client library.\n5. Retry the Base request with the `X-PAYMENT` header — the server\n   verifies via `https://facilitator.payai.network` and responds `200`.\n\n**Optional Solana:** When `paymentOptions` advertises a Solana entry, callers\nmay instead select it and use `PAYMENT-SIGNATURE`. Solana is an additional\noption; use `X-PAYMENT` for the Base option shown by this security scheme.\n\n**Discovery:** `GET /api/billing/x402/config` returns the live `payTo`\naddress, canonical `paymentOptions`, per-call-type USDC amounts, facilitator\nURL, and the credits-per-USDC conversion rate. Always fetch this before\nhardcoding any amounts or a payment header.\n\n**Price range:** $0.0030 per 3-credit call — $0.0050 per 5-credit\ncall (see `x-x402-price-usdc` on each\noperation for the exact amount).\n\n**Facilitator:** `https://facilitator.payai.network` (PayAI-operated,\nverifies the advertised Base and optional Solana options).\n"
    x402Solana:
      type: apiKey
      in: header
      name: PAYMENT-SIGNATURE
      description: 'Optional x402 v2 Solana payment alternative. Use this security option only

        when `GET /api/billing/x402/config` `paymentOptions` advertises a Solana

        network, then send its signed Solana USDC payment payload in the

        `PAYMENT-SIGNATURE` header. Include the option''s `feePayer` detail when

        constructing the transaction.


        For the primary Base payment option, select the `x402` security option

        instead and send its signed payment payload in the `X-PAYMENT` header.

        '
x-refined-from:
- cloudworldmodel-ai-openapi.json
- cloudworldmodel-ai-openapi.yml