> ## Documentation Index
> Fetch the complete documentation index at: https://api-docs.sevalla.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This is the Sevalla REST API reference. Base URL: https://api.sevalla.com/v3. Authenticate with an API key in the Authorization header as a Bearer token.
> The OpenAPI spec is at https://api.sevalla.com/v3/openapi.json. Concepts and dashboard guides are at https://docs.sevalla.com (index: https://docs.sevalla.com/llms.txt).
> To act on a Sevalla account from an AI agent, prefer the Sevalla MCP server (https://mcp.sevalla.com/mcp, see https://docs.sevalla.com/ai-agents/overview.md) or the Sevalla CLI (https://api-docs.sevalla.com/v3/cli.md).

# Exchange a device code for an API key

> Check a device sign-in with the `device_code` from the create endpoint. Poll every 5 seconds (at most 30 requests per minute for each device code and 60 per minute for each IP address) until the status is no longer `pending`. Sign-ins started by the Sevalla MCP server, and device codes created with a `callback_url`, also need the `approval_secret` the dashboard adds to the callback URL, so only the browser that approved can collect the key. When the user has approved, this call creates the API key with the company and permissions the user picked and returns it once. After that the code is gone and later calls return `expired`.



## OpenAPI

````yaml https://api.sevalla.com/v3/openapi.json post /auth/device-codes/token
openapi: 3.1.0
info:
  title: Sevalla API docs
  version: 1.0.0
servers:
  - url: https://api.sevalla.com/v3
security:
  - bearerAuth: []
paths:
  /auth/device-codes/token:
    post:
      tags:
        - Device Authorization
      summary: Exchange a device code for an API key
      description: >-
        Check a device sign-in with the `device_code` from the create endpoint.
        Poll every 5 seconds (at most 30 requests per minute for each device
        code and 60 per minute for each IP address) until the status is no
        longer `pending`. Sign-ins started by the Sevalla MCP server, and device
        codes created with a `callback_url`, also need the `approval_secret` the
        dashboard adds to the callback URL, so only the browser that approved
        can collect the key. When the user has approved, this call creates the
        API key with the company and permissions the user picked and returns it
        once. After that the code is gone and later calls return `expired`.
      operationId: exchangeDeviceCodeV3
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                device_code:
                  type: string
                  minLength: 1
                  description: The `device_code` returned when the device code was created
                  example: kT3n9cQ0yVZr8mWbH1sLx4aPqE6uJ2dFgN7oRtYvS5w
                approval_secret:
                  description: >-
                    The one-time secret the dashboard adds to the callback URL
                    after the user approves. Required for sign-ins started by
                    the Sevalla MCP server and for device codes created with a
                    `callback_url`: without it their status stays `pending`.
                    Device codes without a callback, such as the typed-code
                    sign-in of the Sevalla CLI, do not need it
                  example: Zq8vN2mXc4rT7yWb1kLp9sHd3fJg6uEa0oRiQtYxS5w
                  type: string
                  minLength: 1
              required:
                - device_code
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - pending
                      - approved
                      - denied
                      - expired
                    description: >-
                      Current status of the device code. `pending` - waiting for
                      the user, `approved` - the user approved and `token` is
                      included, `denied` - the user rejected the request,
                      `expired` - the code expired, was already used or does not
                      exist
                    example: pending
                  token:
                    description: >-
                      The new API key, only present when status is `approved`.
                      It is returned once, the code cannot be used again, and
                      the key expires after 90 days. Store it securely
                    example: svl_abc123...
                    type: string
                required:
                  - status
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Bad request
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 400
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
        '429':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Too many requests
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 429
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Internal Server Error
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 500
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
      security: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authentication. Pass your API key as a Bearer token in the
        Authorization header.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.