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

# Create API Key

> Generate an API key bound to your organization

## Prerequisites

You must have an Anzi user with access to the corresponding environment. If you don't have an account and want to try Anzi's guarantee solutions, let's schedule [a call](https://calendly.com/anzi).

<Note>
  The returned `key` is shown only once. Store it securely and use it as
  `X-API-KEY` in your requests.
</Note>

<Note>Rate limit: You can create up to 5 API keys per hour.</Note>


## OpenAPI

````yaml /openapi.yaml post /users/apikeys
openapi: 3.0.3
info:
  title: Anzi Backend API
  version: 1.0.0
  description: |
    API reference for Anzi. This spec is scoped to the Organizations module.
servers:
  - url: https://sandbox-api.anzi.finance/v1
    description: Sanbox
  - url: https://api.anzi.finance/v1
    description: Production
security: []
tags:
  - name: Licenses
    description: Operational licenses
  - name: Users
    description: Manage users and API keys
  - name: Claims
    description: Manage claims
paths:
  /users/apikeys:
    post:
      tags:
        - Users
      summary: Create API key
      description: >
        Creates an API key and assigns it to the user's organization.

        Provide your Anzi account `email` and `password` in the request body.
        These are the credentials assigned for the selected environment (you
        should have received them by email).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAPIKeyDTO'
            examples:
              basic:
                summary: Minimal payload
                value:
                  email: user@company.com
                  password: your-password
                  name: LMS Integration Key
      responses:
        '201':
          description: API key created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIKeyFirstResponseDTO'
              examples:
                created:
                  value:
                    uid: 8f5a1b2c-3d4e-5f6a-9b8c-0d1e2f3a4b5c
                    name: LMS Integration Key
                    status: 0
                    key: ANZI.xxxxxx.yyyyyy.zzzzzz
        '400':
          description: Bad request (validation error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                badRequest:
                  value:
                    code: GE_01
                    message: Invalid parameters
        '401':
          description: Unauthorized (invalid credentials)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  value:
                    code: AUTH_2
                    message: Unauthorized
        '404':
          description: Organization not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                orgNotFound:
                  value:
                    code: ORG_00
                    message: Organization not found
        '500':
          description: Internal error while creating API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                creationError:
                  value:
                    code: APK_02
                    message: API key creation failed
components:
  schemas:
    CreateAPIKeyDTO:
      type: object
      required:
        - email
        - password
        - name
      properties:
        email:
          type: string
          format: email
          description: Anzi account email for the selected environment
          example: user@company.com
        password:
          type: string
          format: password
          description: Password assigned by Anzi for the selected environment
          example: your-password
        name:
          type: string
          description: >-
            Human-friendly name for the API key. Must be 3-50 characters;
            allowed characters letters, numbers, spaces, hyphens, underscores
            and periods.
          minLength: 3
          maxLength: 50
          pattern: ^[a-zA-Z0-9\-_. ]+$
          example: LMS Integration Key
    APIKeyFirstResponseDTO:
      type: object
      description: >-
        Returned only once. Store the `key` securely; it will not be shown
        again.
      properties:
        uid:
          type: string
        name:
          type: string
        status:
          type: integer
          enum:
            - 0
            - 1
          description: 0 = ACTIVE, 1 = INACTIVE
        key:
          type: string
          description: Plain API key value to be used as `X-API-KEY`
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
        message:
          type: string

````