Archal Auth API

CLI and device authentication.

OpenAPI Specification

archal-auth-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Archal Auth API
  summary: Public API for Archal CLI, session, trace, result, and runtime clone integrations.
  description: Archal provisions service-shaped clones of third-party services so AI agents can be tested before they touch production. This spec covers Archal-owned control-plane endpoints and the runtime proxy shape agents use to call clone APIs.
  version: 0.3.0
servers:
- url: https://archal.ai
  description: Archal web and CLI API
- url: https://api.archal.ai
  description: Hosted runtime proxy
security:
- archalToken: []
tags:
- name: Auth
  description: CLI and device authentication.
paths:
  /auth/me:
    get:
      operationId: getCurrentCliUser
      summary: Get the authenticated CLI user
      tags:
      - Auth
      responses:
        '200':
          description: Authenticated user.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthMeResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /auth/device:
    post:
      operationId: createDeviceAuthRequest
      summary: Start CLI device authentication
      tags:
      - Auth
      security: []
      responses:
        '200':
          description: Device-code authentication challenge.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceAuthCreateResponse'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/Unavailable'
  /auth/device/token:
    post:
      operationId: pollDeviceAuthToken
      summary: Poll a device authentication request
      tags:
      - Auth
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeviceAuthTokenRequest'
      responses:
        '200':
          description: Token response when the device flow has been approved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonObject'
        '400':
          $ref: '#/components/responses/BadRequest'
        '428':
          description: Device authorization is still pending.
components:
  responses:
    Unavailable:
      description: Required backing service is unavailable.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Missing, invalid, or expired Archal token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    RateLimited:
      description: Rate limit exceeded.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    BadRequest:
      description: Request is malformed or failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  schemas:
    AuthMeResponse:
      type: object
      required:
      - userId
      - plan
      - selectedCloneIds
      - managedEvaluatorAvailable
      properties:
        userId:
          type: string
        email:
          type:
          - string
          - 'null'
          format: email
        plan:
          type: string
        selectedCloneIds:
          type: array
          items:
            type: string
        managedEvaluatorAvailable:
          type: boolean
    DeviceAuthTokenRequest:
      type: object
      required:
      - device_code
      properties:
        device_code:
          type: string
      additionalProperties: false
    JsonObject:
      type: object
      additionalProperties: true
    DeviceAuthCreateResponse:
      type: object
      required:
      - device_code
      - user_code
      - verification_uri
      - verification_uri_complete
      - expires_in
      - interval
      properties:
        device_code:
          type: string
        user_code:
          type: string
        verification_uri:
          type: string
          format: uri
        verification_uri_complete:
          type: string
          format: uri
        expires_in:
          type: integer
          examples:
          - 600
        interval:
          type: integer
      additionalProperties: false
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
        message:
          type: string
        detail:
          type: string
      additionalProperties: true
  securitySchemes:
    archalToken:
      type: http
      scheme: bearer
      bearerFormat: Archal API token
    routeAuthorization:
      type: apiKey
      in: header
      name: x-route-authorization