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

# Create an API key

> The full key is returned once. Store it somewhere safe.



## OpenAPI

````yaml /openapi.json post /v1/keys
openapi: 3.1.0
info:
  title: datachad API
  description: Accounts, API keys and catalogue access for datachad datasets.
  license:
    name: ''
  version: 1.0.0
servers:
  - url: https://api.datachad.xyz
security: []
tags:
  - name: Auth
    description: Sign up, log in and read the current user.
  - name: API keys
    description: Create and revoke keys for programmatic access.
  - name: Datasets
    description: Browse the catalogue and its metadata.
paths:
  /v1/keys:
    post:
      tags:
        - API keys
      summary: Create an API key
      description: The full key is returned once. Store it somewhere safe.
      operationId: create_key
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateKeyBody'
        required: true
      responses:
        '201':
          description: Key created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NewApiKey'
        '400':
          description: Invalid input or key limit reached
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '401':
          description: Not signed in
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
      security:
        - bearerAuth: []
components:
  schemas:
    CreateKeyBody:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: A label to tell your keys apart.
          example: training cluster
    NewApiKey:
      type: object
      required:
        - id
        - name
        - prefix
        - key
      properties:
        id:
          type: integer
          format: int64
        key:
          type: string
          description: The full key. It is shown once and cannot be retrieved again.
        name:
          type: string
        prefix:
          type: string
    ErrorBody:
      type: object
      required:
        - error
      properties:
        error:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````