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

# Create an API key

> The response contains the key itself. This is the only time it is ever returned — only its hash is stored.



## OpenAPI

````yaml https://api.surnex.io/docs/openapi.json post /v1/organizations/{orgId}/api-keys
openapi: 3.1.0
info:
  title: Surnex API
  version: 1.0.0
  description: >-
    The SEO platform's API.


    **The API is the product.** The dashboard is one client and the MCP server
    at `/mcp` is another. If a number needs deriving, a service derives it —
    never a React component, or the two clients drift.


    **Two kinds of auth.** The dashboard sends a Supabase access token as a
    Bearer JWT. MCP agents send `X-API-Key`, and the organization is resolved
    from the key.


    **Two data modes.** SERP results and Google Trends are fetched live on
    request. Everything else is written by the worker and read from Postgres, so
    a freshly-created project returns empty until its jobs complete.
servers:
  - url: https://api.surnex.io
    description: Surnex API
security: []
paths:
  /v1/organizations/{orgId}/api-keys:
    post:
      tags:
        - api-keys
      summary: Create an API key
      description: >-
        The response contains the key itself. This is the only time it is ever
        returned — only its hash is stored.
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: orgId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 120
                expires_at:
                  type: string
                  nullable: true
                  format: date-time
                access:
                  type: string
                  enum:
                    - full
                    - read
                  default: full
              required:
                - name
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    nullable: true
                    properties:
                      id:
                        type: string
                        format: uuid
                      name:
                        type: string
                      prefix:
                        type: string
                      access:
                        type: string
                        enum:
                          - full
                          - read
                      is_active:
                        type: boolean
                      last_used_at:
                        type: string
                        nullable: true
                        format: date-time
                      expires_at:
                        type: string
                        nullable: true
                        format: date-time
                      created_at:
                        type: string
                        format: date-time
                      key:
                        type: string
                    required:
                      - id
                      - name
                      - prefix
                      - access
                      - is_active
                      - last_used_at
                      - expires_at
                      - created_at
                      - key
                required:
                  - success
                  - data

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.