api_keys ยท version 0.1.0

Create a workspace API key

POST /api/api-keys

Creates a programmatic bearer token. The `token` is returned once and Sourced stores only a hash.

Request

POST https://sourced.sh/api/api-keys

Request body

application/json

ApiKeyCreateInput:
  type: object
  properties:
    name: string
    scopes: array
      Optional API key scopes. When omitted, Sourced creates a narrow key with `workspace:read`, `projects:write`, `runs:write`, and `artifacts:read`. Enforced public scopes include `workspace:read`, `projects:write`, `runs:write`, `artifacts:read`, `artifacts:write`, `api_keys:read`, `api_keys:write`, `billing:write`, `notifications:read`, `notifications:write`, `domains:read`, `domains:write`, `members:read`, `members:write`, `publishing:dry_run`, and `publishing:write`.
      type: array
      description: Optional API key scopes. When omitted, Sourced creates a narrow key with `workspace:read`, `projects:write`, `runs:write`, and `artifacts:read`. Enforced public scopes include `workspace:read`, `projects:write`, `runs:write`, `artifacts:read`, `artifacts:write`, `api_keys:read`, `api_keys:write`, `billing:write`, `notifications:read`, `notifications:write`, `domains:read`, `domains:write`, `members:read`, `members:write`, `publishing:dry_run`, and `publishing:write`.

Responses

201

API key created.

application/json

type: object
required: apiKey, token
properties:
  apiKey (required): ApiKey
    ApiKey:
      type: object
      required: id, name, tokenPrefix, scopes, createdAt
      properties:
        id (required): string
        orgId: string
        createdByUserId: string
        name (required): string
        tokenPrefix (required): string
          Non-secret token prefix for display and support.
        scopes (required): array
          type: array
        lastUsedAt: string
        revokedAt: string
        createdAt (required): string
        updatedAt: string
  token (required): string
    Secret bearer token, shown once.

401

403

Back to version index