Create API Key

Create a new API key for programmatic access

Create a new API key for programmatic access

Authentication#

This endpoint requires a valid user session token. If you do not yet have an API key, obtain a session token by logging in first and pass it as a Bearer token in the Authorization header.

Step 1 — Log in to get a session token

theme={null}
curl -X POST https://app.paladin.northmanngrp.com/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com", "password": "your-password"}'

The response contains a token field. Use it in the next step.

Step 2 — Create an API key

theme={null}
curl -X POST https://app.paladin.northmanngrp.com/api/v1/user/api-keys \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"name": "my-api-key"}'

Once you have an API key, you can use X-API-Key: <key> in place of Authorization: Bearer for all subsequent requests.

OpenAPI#

POST /api/v1/user/api-keys
openapi: 3.1.0
info:
  title: Paladin API
  description: API for the Paladin app
  version: 1.0.0
servers:
  - url: https://app.paladin.northmanngrp.com
    description: Production

security: []
paths:
  /api/v1/user/api-keys:
    post:
      tags:
        - main
      summary: Create Api Key
      description: Create a new API key for the user's selected organization.
      operationId: create_api_key_api_v1_user_api_keys_post
      parameters:
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
        - name: X-API-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAPIKeyRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateAPIKeyResponse'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateAPIKeyRequest:
      properties:
        name:
          type: string
          title: Name
      type: object
      required:
        - name
      title: CreateAPIKeyRequest
    CreateAPIKeyResponse:
      properties:
        id:
          type: integer
          title: Id
        name:
          type: string
          title: Name
        key_prefix:
          type: string
          title: Key Prefix
        api_key:
          type: string
          title: Api Key
        created_at:
          type: string
          format: date-time
          title: Created At
      type: object
      required:
        - id
        - name
        - key_prefix
        - api_key
        - created_at
      title: CreateAPIKeyResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError