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

# Generate a new API key



## OpenAPI

````yaml api-reference/openapi.json post /api/api-keys/generate
openapi: 3.0.0
info:
  title: Bigcapital
  description: Financial accounting software
  version: '1.0'
  contact: {}
servers: []
security: []
tags: []
paths:
  /api/api-keys/generate:
    post:
      tags:
        - Api keys
      summary: Generate a new API key
      operationId: AuthApiKeysController_generate
      parameters:
        - name: Authorization
          in: header
          description: >-
            Value must be 'Bearer <token>' where <token> is an API key prefixed
            with 'bc_' or a JWT token.
          required: true
          schema:
            type: string
            example: Bearer bc_1234567890abcdef
        - name: organization-id
          in: header
          description: >-
            Required if Authorization is a JWT token. The organization ID to
            operate within.
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateApiKeyDto'
      responses:
        '201':
          description: The generated API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyResponseDto'
components:
  schemas:
    GenerateApiKeyDto:
      type: object
      properties:
        name:
          type: string
          description: Optional name for the API key
          example: My API Key
    ApiKeyResponseDto:
      type: object
      properties:
        id:
          type: number
          example: 1
          description: API key ID
        key:
          type: string
          example: bc_1234567890abcdef
          description: The API key string
      required:
        - id
        - key

````