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

# Issue an access token

> `client_credentials` grant. Credentials via Basic auth or the body. Returns an opaque Bearer (~1h).



## OpenAPI

````yaml https://api.apyconnect.io/v1/openapi.json post /oauth/token
openapi: 3.1.0
info:
  title: ApyConnect API
  version: 1.0.0
  description: >-
    ApyConnect public API. OAuth 2.0 authentication (client_credentials grant)
    with opaque Bearer tokens. Wrapped responses ({data, meta} / {object:'list',
    data, pagination, meta}); typed errors with trace_id; cursor pagination;
    snake_case throughout the JSON. Rate limit per Application.


    Best practices: send an `Idempotency-Key` header on writes to make retries
    safe (the same key replays the stored response for 24h; reusing a key with a
    different body returns 409). Use `?expand=contact` (and `expand=company` on
    deals) to embed related resources and save round-trips. Deprecated endpoints
    carry RFC 8594 `Deprecation`/`Sunset` headers. Inspect usage at `/v1/usage`
    and the write audit trail at `/v1/audit-logs`.
  contact:
    name: ApyConnect
    url: https://docs.apyconnect.io
servers:
  - url: https://api.apyconnect.io
    description: Production
security:
  - bearerAuth: []
tags:
  - name: OAuth
  - name: Contacts
  - name: Conversations
  - name: Messages
  - name: Channels
  - name: Inboxes
  - name: Campaigns
  - name: Analytics
  - name: Webhooks
  - name: Deals
  - name: Tasks
  - name: Companies
  - name: Tickets
  - name: Notes
  - name: Segments
  - name: Macros
  - name: Settings
  - name: Jobs
  - name: Observability
paths:
  /oauth/token:
    post:
      tags:
        - OAuth
      summary: Issue an access token
      description: >-
        `client_credentials` grant. Credentials via Basic auth or the body.
        Returns an opaque Bearer (~1h).
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TokenRequest'
          application/json:
            schema:
              $ref: '#/components/schemas/TokenRequest'
      responses:
        '200':
          description: Token issued
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenResponse'
        '400':
          description: unsupported_grant_type
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuthError'
        '401':
          description: invalid_client
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuthError'
      security: []
components:
  schemas:
    TokenRequest:
      type: object
      properties:
        grant_type:
          type: string
          enum:
            - client_credentials
        client_id:
          type: string
        client_secret:
          type: string
      required:
        - grant_type
    TokenResponse:
      type: object
      properties:
        access_token:
          type: string
        token_type:
          type: string
          const: Bearer
        expires_in:
          type: integer
    OAuthError:
      type: object
      properties:
        error:
          type: string
        error_description:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Opaque token issued by /oauth/token.

````