agent-swarm.devagent-swarm.dev

API Keys

Manage API keys for authenticating requests to the agent-swarm.dev API

GET/api/keys/available

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Query Parameters

keyType*string
totalKeys*integer
Range1 <= value
scope?string
scopeId?string
model?string
Value in"fable" | "opus" | "sonnet" | "haiku"
keySuffixes?string

Response Body

application/json

application/json

application/json

curl -X GET "http://localhost:3013/api/keys/available?keyType=string&totalKeys=1"
{
  "success": true,
  "availableIndices": [
    0
  ],
  "rejectedIndices": [
    0
  ],
  "totalKeys": 0,
  "modelBlockedIndices": [
    0
  ],
  "earliestModelResetAt": "string",
  "seatBlockedIndices": [
    0
  ],
  "spendCappedIndices": [
    0
  ],
  "authFailureFence": 0,
  "keyUsage": [
    0
  ],
  "activeSessions": [
    0
  ]
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
POST/api/keys/clear-rate-limit

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "http://localhost:3013/api/keys/clear-rate-limit" \  -H "Content-Type: application/json" \  -d '{    "keyType": "string",    "keySuffix": "string"  }'
{
  "success": true,
  "cleared": true,
  "message": "string"
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
GET/api/keys/costs

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Query Parameters

keyType?string

Response Body

application/json

application/json

curl -X GET "http://localhost:3013/api/keys/costs"
{
  "success": true,
  "costs": [
    {
      "keyType": "string",
      "keySuffix": "string",
      "totalCost": 0,
      "totalInputTokens": 0,
      "totalOutputTokens": 0,
      "taskCount": 0
    }
  ]
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
PATCH/api/keys/name

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X PATCH "http://localhost:3013/api/keys/name" \  -H "Content-Type: application/json" \  -d '{    "keyType": "string",    "keySuffix": "string",    "name": "string"  }'
{
  "success": true,
  "keyType": "string",
  "keySuffix": "string",
  "name": "string"
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
PATCH/api/keys/plan

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X PATCH "http://localhost:3013/api/keys/plan" \  -H "Content-Type: application/json" \  -d '{    "keyType": "string",    "keySuffix": "string",    "plan": "string"  }'
{
  "success": true,
  "keyType": "string",
  "keySuffix": "string",
  "plan": "string"
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
GET/api/keys/plans

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Response Body

application/json

curl -X GET "http://localhost:3013/api/keys/plans"
{
  "checkedAt": "string",
  "plans": [
    {
      "id": "string",
      "label": "string",
      "keyType": "string",
      "monthlyUsd": 0
    }
  ]
}
POST/api/keys/report-auth-failure

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "http://localhost:3013/api/keys/report-auth-failure" \  -H "Content-Type: application/json" \  -d '{    "keyType": "string",    "keySuffix": "string",    "keyIndex": 0  }'
{
  "success": true,
  "consecutiveAuthFailures": 0,
  "benched": true,
  "rateLimitedUntil": "string"
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
POST/api/keys/report-rate-limit

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "http://localhost:3013/api/keys/report-rate-limit" \  -H "Content-Type: application/json" \  -d '{    "keyType": "string",    "keySuffix": "string",    "keyIndex": 0,    "rateLimitedUntil": "2019-08-24T14:15:22Z"  }'
{
  "success": true,
  "message": "string"
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
POST/api/keys/report-rate-limit-windows

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "http://localhost:3013/api/keys/report-rate-limit-windows" \  -H "Content-Type: application/json" \  -d '{    "keyType": "string",    "keySuffix": "string",    "keyIndex": 0,    "windows": {      "property1": {        "status": "string",        "lastSeenAt": "2019-08-24T14:15:22Z"      },      "property2": {        "status": "string",        "lastSeenAt": "2019-08-24T14:15:22Z"      }    }  }'
{
  "success": true,
  "message": "string"
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
POST/api/keys/report-seat-mismatch

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "http://localhost:3013/api/keys/report-seat-mismatch" \  -H "Content-Type: application/json" \  -d '{    "keyType": "string",    "keySuffix": "string",    "keyIndex": 0,    "model": "fable"  }'
{
  "success": true,
  "message": "string"
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
POST/api/keys/report-usage

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "http://localhost:3013/api/keys/report-usage" \  -H "Content-Type: application/json" \  -d '{    "keyType": "string",    "keySuffix": "string",    "keyIndex": 0  }'
{
  "success": true,
  "message": "string"
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
POST/api/keys/report-validation

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "http://localhost:3013/api/keys/report-validation" \  -H "Content-Type: application/json" \  -d '{    "keyType": "string",    "keys": [      {        "keyIndex": 0,        "keySuffix": "string",        "ok": true      }    ]  }'
{
  "success": true,
  "message": "string"
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
GET/api/keys/status

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Query Parameters

keyType?string
scope?string
scopeId?string

Response Body

application/json

application/json

curl -X GET "http://localhost:3013/api/keys/status"
{
  "success": true,
  "keys": [
    {
      "id": "string",
      "keyType": "string",
      "keySuffix": "string",
      "keyIndex": 0,
      "scope": "string",
      "scopeId": "string",
      "status": "string",
      "rateLimitedUntil": "string",
      "spendCap": {
        "limitUsd": 0,
        "spendUsd": 0,
        "resetsAt": "2019-08-24T14:15:22Z"
      },
      "lastUsedAt": "string",
      "lastRateLimitAt": "string",
      "totalUsageCount": 0,
      "rateLimitCount": 0,
      "name": "string",
      "provider": "string",
      "rateLimitWindows": {
        "property1": {
          "status": "string",
          "utilization": 0,
          "resetsAt": 0,
          "fieldObservedAt": {
            "durationMins": "2019-08-24T14:15:22Z",
            "resetsAt": "2019-08-24T14:15:22Z",
            "label": "2019-08-24T14:15:22Z",
            "normalModelSlug": "2019-08-24T14:15:22Z"
          },
          "durationMins": 576000,
          "source": "claude",
          "limitId": "string",
          "label": "string",
          "normalModelSlug": "string",
          "overageStatus": "string",
          "overageDisabledReason": "string",
          "isUsingOverage": true,
          "surpassedThreshold": 0,
          "lastSeenAt": "2019-08-24T14:15:22Z"
        },
        "property2": {
          "status": "string",
          "utilization": 0,
          "resetsAt": 0,
          "fieldObservedAt": {
            "durationMins": "2019-08-24T14:15:22Z",
            "resetsAt": "2019-08-24T14:15:22Z",
            "label": "2019-08-24T14:15:22Z",
            "normalModelSlug": "2019-08-24T14:15:22Z"
          },
          "durationMins": 576000,
          "source": "claude",
          "limitId": "string",
          "label": "string",
          "normalModelSlug": "string",
          "overageStatus": "string",
          "overageDisabledReason": "string",
          "isUsingOverage": true,
          "surpassedThreshold": 0,
          "lastSeenAt": "2019-08-24T14:15:22Z"
        }
      },
      "providerAccount": {
        "source": "codex",
        "observedAt": "2019-08-24T14:15:22Z",
        "fieldObservedAt": {
          "ordinaryUsageAllowed": "2019-08-24T14:15:22Z",
          "resetCreditsAvailable": "2019-08-24T14:15:22Z"
        },
        "ordinaryUsageAllowed": true,
        "resetCreditsAvailable": 0,
        "limits": {
          "property1": {
            "observedAt": "2019-08-24T14:15:22Z",
            "fieldObservedAt": {
              "planRaw": "2019-08-24T14:15:22Z",
              "label": "2019-08-24T14:15:22Z",
              "normalModelSlug": "2019-08-24T14:15:22Z",
              "credits": "2019-08-24T14:15:22Z",
              "spend": "2019-08-24T14:15:22Z",
              "spendControlReached": "2019-08-24T14:15:22Z",
              "reachedType": "2019-08-24T14:15:22Z"
            },
            "windowRemovedAt": {
              "primary": "2019-08-24T14:15:22Z",
              "secondary": "2019-08-24T14:15:22Z"
            },
            "planRaw": "string",
            "label": "string",
            "normalModelSlug": "string",
            "credits": {
              "hasCredits": true,
              "unlimited": true,
              "balance": "string"
            },
            "spend": {
              "limit": "string",
              "used": "string",
              "remainingPercent": -2147483648,
              "resetsAt": 8640000000000
            },
            "spendControlReached": true,
            "reachedType": "string"
          },
          "property2": {
            "observedAt": "2019-08-24T14:15:22Z",
            "fieldObservedAt": {
              "planRaw": "2019-08-24T14:15:22Z",
              "label": "2019-08-24T14:15:22Z",
              "normalModelSlug": "2019-08-24T14:15:22Z",
              "credits": "2019-08-24T14:15:22Z",
              "spend": "2019-08-24T14:15:22Z",
              "spendControlReached": "2019-08-24T14:15:22Z",
              "reachedType": "2019-08-24T14:15:22Z"
            },
            "windowRemovedAt": {
              "primary": "2019-08-24T14:15:22Z",
              "secondary": "2019-08-24T14:15:22Z"
            },
            "planRaw": "string",
            "label": "string",
            "normalModelSlug": "string",
            "credits": {
              "hasCredits": true,
              "unlimited": true,
              "balance": "string"
            },
            "spend": {
              "limit": "string",
              "used": "string",
              "remainingPercent": -2147483648,
              "resetsAt": 8640000000000
            },
            "spendControlReached": true,
            "reachedType": "string"
          }
        }
      },
      "plan": "string",
      "planSource": "manual",
      "detectedPlanRaw": "string",
      "lastSeatMismatchAt": "string",
      "lastSeatMismatchModel": "string",
      "consecutiveAuthFailures": 0,
      "lastAuthFailureAt": "string",
      "lastValidationError": "string",
      "lastValidationFailedAt": "string",
      "modelLimits": [
        {
          "model": "string",
          "window": "string",
          "resetsAt": 0,
          "resetsAtIso": "string",
          "active": true
        }
      ],
      "createdAt": "string",
      "updatedAt": "string"
    }
  ]
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
GET/api/keys/window-usage

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Query Parameters

keyType?string
Lengthlength <= 128
keySuffix?string
Length1 <= length <= 10
scope?string
Lengthlength <= 64
scopeId?string
Lengthlength <= 128

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "http://localhost:3013/api/keys/window-usage"
{
  "success": true,
  "asOf": "string",
  "accounting": "session_cost_receipt_time",
  "windows": [
    {
      "statusId": "string",
      "keyType": "string",
      "keySuffix": "string",
      "scope": "string",
      "scopeId": "string",
      "windowKey": "string",
      "durationMins": 0,
      "startsAt": "string",
      "endsAt": "string",
      "dataThrough": "string",
      "observedAt": "string",
      "observationAgeMs": 0,
      "modelScope": {
        "kind": "account",
        "model": "string"
      },
      "unavailableReason": "missing_reset",
      "usage": {
        "sessions": 0,
        "errorSessions": 0,
        "completedTasks": 0,
        "tokens": {
          "uncachedInput": {
            "value": 0,
            "measuredSessions": 0,
            "missingSessions": 0
          },
          "output": {
            "value": 0,
            "measuredSessions": 0,
            "missingSessions": 0
          },
          "cacheRead": {
            "value": 0,
            "measuredSessions": 0,
            "missingSessions": 0
          },
          "cacheWrite": {
            "value": 0,
            "measuredSessions": 0,
            "missingSessions": 0
          },
          "reasoning": {
            "value": 0,
            "measuredSessions": 0,
            "missingSessions": 0
          },
          "thinking": {
            "value": 0,
            "measuredSessions": 0,
            "missingSessions": 0
          }
        },
        "modelUnattributedSessions": 0,
        "swarmUnattributedSessions": 0
      }
    }
  ]
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}