B3

B3 Api Keys API

The Api Keys API from B3 — 2 operation(s) for api keys.

OpenAPI Specification

b3-api-keys-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  description: Workflow management API for B3OS
  title: B3OS Workflow Action Api Keys API
  version: '1.0'
tags:
- name: Api Keys
paths:
  /v1/api-keys:
    get:
      description: List all API keys for the current organization
      parameters:
      - description: Number of items (default 20, max 100)
        in: query
        name: limit
        schema:
          type: integer
      - description: Offset for pagination (default 0)
        in: query
        name: offset
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListAPIKeysSuccessResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Bad Request
      tags:
      - Api Keys
    post:
      description: Create a new API key for the current organization
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
              - type: object
              - $ref: '#/components/schemas/CreateAPIKeyParams'
                summary: request
                description: API key details
        description: API key details
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateAPIKeySuccessResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Bad Request
      tags:
      - Api Keys
  /v1/api-keys/{id}:
    delete:
      description: Revoke an API key by ID
      parameters:
      - description: API key ID
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RevokeAPIKeySuccessResponse'
          description: OK
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Not Found
      tags:
      - Api Keys
    get:
      description: Get a single API key by ID
      parameters:
      - description: API key ID
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAPIKeySuccessResponse'
          description: OK
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Not Found
      tags:
      - Api Keys
components:
  schemas:
    CreateAPIKeySuccessResponse:
      properties:
        code:
          example: 200
          type: integer
        data:
          $ref: '#/components/schemas/CreateAPIKeyData'
        message:
          example: success
          type: string
        requestId:
          example: abc-123
          type: string
      type: object
    RevokeAPIKeySuccessResponse:
      properties:
        code:
          example: 200
          type: integer
        message:
          example: success
          type: string
        requestId:
          example: abc-123
          type: string
      type: object
    GetAPIKeySuccessResponse:
      properties:
        code:
          example: 200
          type: integer
        data:
          $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_pkg_entity.APIKey'
        message:
          example: success
          type: string
        requestId:
          example: abc-123
          type: string
      type: object
    ListAPIKeysSuccessResponse:
      properties:
        code:
          example: 200
          type: integer
        data:
          $ref: '#/components/schemas/PaginatedData-github_com_b3-fun_b3-mono_services_b3os-workflow_internal_pkg_entity_APIKey'
        message:
          example: success
          type: string
        requestId:
          example: abc-123
          type: string
      type: object
    CreateAPIKeyParams:
      properties:
        description:
          type: string
        expiresAt:
          type: string
        name:
          type: string
        scope:
          type: string
      required:
      - name
      - scope
      type: object
    github_com_b3-fun_b3-mono_services_b3os-workflow_internal_pkg_entity.APIKey:
      properties:
        createdAt:
          type: string
        description:
          type: string
        expiresAt:
          type: string
        id:
          type: string
        keyPrefix:
          type: string
        lastUsedAt:
          type: string
        name:
          type: string
        organizationId:
          type: string
        revokedAt:
          type: string
        scope:
          $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_pkg_entity.APIKeyScope'
        userId:
          type: string
      type: object
    CreateAPIKeyData:
      properties:
        createdAt:
          type: string
        description:
          type: string
        expiresAt:
          type: string
        id:
          type: string
        key:
          description: Key is the full plaintext API key, shown only once. Store it securely.
          type: string
        keyPrefix:
          type: string
        lastUsedAt:
          type: string
        name:
          type: string
        organizationId:
          type: string
        revokedAt:
          type: string
        scope:
          $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_pkg_entity.APIKeyScope'
        userId:
          type: string
      type: object
    PaginatedData-github_com_b3-fun_b3-mono_services_b3os-workflow_internal_pkg_entity_APIKey:
      properties:
        hasMore:
          type: boolean
        items:
          items:
            $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_pkg_entity.APIKey'
          type: array
          uniqueItems: false
        limit:
          type: integer
        offset:
          type: integer
      type: object
    github_com_b3-fun_b3-mono_services_b3os-workflow_internal_pkg_entity.APIKeyScope:
      enum:
      - read
      - read-write
      type: string
      x-enum-varnames:
      - APIKeyScopeRead
      - APIKeyScopeReadWrite
    github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse:
      properties:
        code:
          type: integer
        details:
          items: {}
          type: array
          uniqueItems: false
        message:
          type: string
        requestId:
          type: string
      type: object