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

# Create an API key



## OpenAPI

````yaml /openapi/sinjapp-business.v1.yaml post /api-keys
openapi: 3.0.3
info:
  title: Sinjapp Business API
  version: 1.0.0
  description: |
    Sinjapp Business exposes a Tenant API for customer messaging operations.
  license:
    name: Proprietary
    url: https://sinjapp.com/legal/terms
servers:
  - url: '{tenantBaseUrl}/api/v1'
    description: Tenant API
    variables:
      tenantBaseUrl:
        default: https://your-tenant.sinjapp.org
        description: >-
          Full customer tenant URL, including https://. Use the exact tenant
          workspace domain shown in the dashboard.
security:
  - ApiKeyAuth: []
tags:
  - name: Auth
    description: Tenant identity and runtime context.
  - name: Subscription
    description: >-
      Tenant subscription status. Payment and plan changes happen inside the
      tenant dashboard.
  - name: API Keys
    description: Tenant API credentials and scopes.
  - name: Sender Numbers
    description: Sender number registration and activation state.
  - name: Messages
    description: Sending and reading message logs.
  - name: Contacts
    description: Contact reachability checks.
  - name: Usage
    description: Usage counters and limits.
paths:
  /api-keys:
    post:
      tags:
        - API Keys
      summary: Create an API key
      operationId: createApiKey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                  example: Production integration
                scopes:
                  type: array
                  items:
                    type: string
                    enum:
                      - '*'
                      - contacts.lookup
                      - messages.send
                      - messages.read
                      - usage.read
                  example:
                    - messages.send
                    - messages.read
                expires_in_days:
                  type: integer
                  minimum: 1
                  maximum: 365
                  default: 90
      responses:
        '201':
          description: API key created. The plain text key is returned in this response.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ApiKey'
                  plain_text_key:
                    type: string
                    example: tgo_Rm9vQmFyQmF6...
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  schemas:
    ApiKey:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        prefix:
          type: string
        scopes:
          type: array
          items:
            type: string
        status:
          type: string
          enum:
            - active
            - revoked
        expires_at:
          type: string
          format: date-time
          nullable: true
        last_used_at:
          type: string
          format: date-time
          nullable: true
  responses:
    ValidationError:
      description: Validation failed.
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
              errors:
                type: object
                additionalProperties:
                  type: array
                  items:
                    type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key

````