POST/api/orgs/{org_id}/keys

Create a key with its group, budget and limits

One call creates the key, and optionally a new group (identity) and a new shared budget (budget), and sets its rate limits and IP rules. Give identity_id or identity, not both; neither puts the key in the default group. Give budget_id or budget, not both. The whole body is validated before anything is written; if a later step fails, everything the call created is removed and the key is revoked. The plaintext key is returned only here. Org admin or the provisioning key.

Authentication: Bearer API key in the Authorization header

Path parameters

  • org_idstringrequired

    Your organization id (uuid). GET /api/whoami returns it.

Request body

  • namestringrequired

    1 to 80 characters after trimming.

  • provisioningboolean

    Create a provisioning key.

    Default: false
  • expires_in_daysinteger | null

    Omitted, the key never expires.

  • identity_idstring | null

    An existing active group.

  • identityobject | null
    One of

    object

    • display_namestringrequired
    • parent_identity_idstring | null

      The parent group; restrictions only tighten going down.

    • modelsarray | null

      Model slugs or alias ids the group may call. Omitted, the group inherits its parent's models (every model for a top-level group).

  • budget_idstring | null

    An existing shared budget.

  • budgetobject | null
    One of

    object

    • namestring | null

      Defaults to the key's name.

    • limit_nano_usdintegerrequired

      Integer nano-USD per window.

    • reset_periodenum
      "daily""weekly""monthly""yearly"
      Default: "monthly"
  • rate_limitsobject | null
    One of

    object

    • requests_per_minuteinteger | null
    • tokens_per_minuteinteger | null
    • tokens_per_hourinteger | null
    • tokens_per_dayinteger | null
  • ip_rulesobject | null
    One of

    object

    • modeenumrequired

      allow serves the key only from these ranges; deny never from them.

      "allow""deny"
    • cidrsarray<string>required

      IPv4 or IPv6 ranges in CIDR notation.

Responses

  • 201

    The key and its one-time plaintext.

    Response
    • keystringrequired

      The plaintext key, returned only here.

    • dataobjectrequired
      data
      • idstringrequired
      • namestringrequired
      • labelstringrequired

        Key prefix and last characters.

      • identity_idstring | nullrequired

        The key's group.

      • budgetobject | nullrequired

        The shared budget the key draws from.

        One of

        object

        • budget_idstringrequired
        • periodstringrequired

          YYYY-MM, or * for recurring.

        • scope_kindenumrequired

          keys is a shared budget; key is an older per-key budget.

          "team""identity""key""model""pool""deployment""keys"
        • api_key_idstring | nullrequired
        • identity_idstring | nullrequired
        • alias_idstring | nullrequired
        • pool_idstring | nullrequired
        • deployment_idstring | nullrequired
        • limit_nano_usdintegerrequired

          The cap, integer nano-USD. 0 is a hard zero cap.

        • reserved_nano_usdintegerrequired

          In flight, integer nano-USD.

        • settled_nano_usdintegerrequired

          Spent this month, integer nano-USD.

        • remaining_nano_usdintegerrequired

          Integer nano-USD.

        • created_by_kindenumrequired
          "session""api_key"
        • created_by_api_key_idstring | nullrequired

          The authoring key, when a key wrote the row.

        • namestring | null

          Shared budgets only.

        • reset_periodenum

          Shared budgets only.

          "daily""weekly""monthly""yearly"null
        • api_key_idsarray | null

          Shared budgets only: the keys drawing from it.

      • rate_limitsobject | nullrequired

        Null when the key uses its tier's windows.

        One of

        object

        • requests_per_minuteinteger | nullrequired
        • tokens_per_minuteinteger | nullrequired
        • tokens_per_hourinteger | nullrequired
        • tokens_per_dayinteger | nullrequired
      • ip_rulesobject | null

        The key's IP rules; null when it serves from any address.

        One of

        object

        • modeenumrequired

          allow serves the key only from these ranges; deny never from them.

          "allow""deny"
        • cidrsarray<string>required

          IPv4 or IPv6 ranges in CIDR notation.

      • legacy_spend_capsarray<object>required
        legacy_spend_caps
        • limit_nano_usdintegerrequired
        • periodstringrequired
      • is_provisioningbooleanrequired
      • expires_atstring | nullrequired
      • created_atstringrequired
      • revoked_atstring | nullrequired
  • 401

    Missing, unknown or revoked API key.

    Response
    • errorstringrequired

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 403

    Not a provisioning key, or the mint is refused for this group.

    Response
    • errorstringrequired

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 404

    Unknown organization, group, parent group, shared budget or model.

    Response
    • errorstringrequired

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 409

    A disabled group, or a budget name already in use.

    Response
    • errorstringrequired

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 422

    Both of a pair given, a bad name, reset period or IP range, or body validation.

Request

curl -X POST 'https://api.experientiallabs.ai/api/orgs/3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10/keys' \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "contractor-alice",
  "expires_in_days": 90,
  "identity": {
    "display_name": "Contractors",
    "models": [
      "claude-sonnet-4.6",
      "gpt-6-luna",
      "deepseek-v4-flash"
    ]
  },
  "budget": {
    "name": "Alice",
    "limit_nano_usd": 100000000000,
    "reset_period": "monthly"
  },
  "rate_limits": {
    "requests_per_minute": 60
  },
  "ip_rules": {
    "mode": "allow",
    "cidrs": [
      "203.0.113.0/24"
    ]
  }
}'

Response

{
  "key": "<new-api-key-shown-once>",
  "data": {
    "id": "11111111-1111-1111-1111-111111111111",
    "name": "contractor-alice",
    "label": "xpl_live_3b7e…04fc",
    "identity_id": "contractors-7c1e40ab",
    "budget": {
      "budget_id": "c4a2e8f1-7b3d-4e9a-8c15-3f0d6b2a9e71",
      "period": "*",
      "scope_kind": "keys",
      "api_key_id": null,
      "identity_id": null,
      "alias_id": null,
      "pool_id": null,
      "deployment_id": null,
      "limit_nano_usd": 100000000000,
      "reserved_nano_usd": 0,
      "settled_nano_usd": 0,
      "remaining_nano_usd": 100000000000,
      "created_by_kind": "api_key",
      "created_by_api_key_id": "6b1d2f4e-3c8a-4f0e-9a21-7e5c0d9b4a33",
      "name": "Alice",
      "reset_period": "monthly",
      "api_key_ids": [
        "11111111-1111-1111-1111-111111111111"
      ]
    },
    "rate_limits": {
      "requests_per_minute": 60,
      "tokens_per_minute": null,
      "tokens_per_hour": null,
      "tokens_per_day": null
    },
    "ip_rules": {
      "mode": "allow",
      "cidrs": [
        "203.0.113.0/24"
      ]
    },
    "legacy_spend_caps": [],
    "is_provisioning": false,
    "expires_at": "2027-02-20T16:10:03.220Z",
    "created_at": "2026-11-22T16:10:03.220Z",
    "revoked_at": null
  }
}

https://api.experientiallabs.ai/api/orgs/3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10/keys