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

# Create new API key

> Creates a new API key for the project with specified permissions



## OpenAPI

````yaml post /project/{id}/key
openapi: 3.0.0
info:
  title: Basic Admin API
  description: API for Basic Admin
  version: 0.1.0
servers:
  - url: https://api.basic.tech
    description: Production server
  - url: https://beta.api.basic.tech
    description: Staging server
  - url: http://localhost:3003
    description: Development server
security: []
tags:
  - name: auth
    description: Authentication and authorization end-points
  - name: projects
    description: Project management end-points
  - name: project-keys
    description: Project API key management end-points
  - name: project-users
    description: Project user management end-points
  - name: project-schema
    description: Project schema management end-points
  - name: project-upload
    description: Project image upload end-points
  - name: teams
    description: Project user management end-points
  - name: utils
    description: Utility end-points - very useful, trust me
externalDocs:
  url: https://docs.basic.tech
  description: Find more info here
paths:
  /project/{id}/key:
    post:
      tags:
        - project-keys
      summary: Create new API key
      description: Creates a new API key for the project with specified permissions
      parameters:
        - schema:
            type: string
          in: path
          name: id
          required: true
          description: Unique identifier of the project
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - label
                - roles
              properties:
                label:
                  type: string
                  description: A descriptive name for the API key
                roles:
                  type: string
                  description: Comma-separated list of permissions for this key
        required: true
      responses:
        '200':
          description: API key created successfully
          content:
            application/json:
              schema:
                description: API key created successfully
                type: object
                properties:
                  key:
                    type: object
                    properties:
                      id:
                        type: string
                      label:
                        type: string
                      roles:
                        type: string
                      value:
                        type: string
                        description: >-
                          The actual API key value. Save this immediately as it
                          cannot be retrieved later.
                      created_at:
                        type: string
                        format: date-time
        '400':
          description: Bad Request - Invalid input
          content:
            application/json:
              schema:
                description: Bad Request - Invalid input
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
        '401':
          description: Unauthorized - Invalid or missing authentication
          content:
            application/json:
              schema:
                description: Unauthorized - Invalid or missing authentication
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
      security:
        - bearerAuth: []
        - apiKeyAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT Authorization Token header using the Bearer scheme
    apiKeyAuth:
      type: http
      scheme: bearer
      description: API Key Authorization header using the Bearer scheme

````