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

# Exchange a code or refresh token for an access token



## OpenAPI

````yaml /api-reference/openapi.json post /oauth/token
openapi: 3.1.0
info:
  title: Meradomo Public API
  version: 1.0.0
  description: >-
    Two surfaces: the local management API on 127.0.0.1:8765 (Publish) and the
    OAuth endpoints on account.meradomo.com (Connect). No SDK — these HTTP
    endpoints are the integration surface.
  license:
    name: MIT
servers:
  - url: http://127.0.0.1:8765
    description: Local management API (Publish)
  - url: https://account.meradomo.com
    description: Control plane (Connect / OAuth)
security: []
paths:
  /oauth/token:
    post:
      tags:
        - Connect (OAuth)
      summary: Exchange a code or refresh token for an access token
      operationId: token
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TokenRequest'
      responses:
        '200':
          description: Tokens
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenResponse'
        '400':
          description: OAuth error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuthError'
      servers:
        - url: https://account.meradomo.com
components:
  schemas:
    TokenRequest:
      type: object
      properties:
        grant_type:
          type: string
          enum:
            - authorization_code
            - refresh_token
        code:
          type: string
        redirect_uri:
          type: string
        client_id:
          type: string
        client_secret:
          type: string
          description: Confidential clients only.
        code_verifier:
          type: string
        refresh_token:
          type: string
    TokenResponse:
      type: object
      properties:
        access_token:
          type: string
        token_type:
          type: string
          enum:
            - Bearer
        expires_in:
          type: integer
          example: 600
        refresh_token:
          type: string
        scope:
          type: string
          example: connect
        address:
          type: string
          example: https://you.meradomo.com
        host:
          type: string
          example: you.meradomo.com
    OAuthError:
      type: object
      properties:
        error:
          type: string
          example: invalid_grant

````