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

# Create a remote API key



## OpenAPI

````yaml https://api.batchrelay.com/openapi.json post /v1/api-accounts/{account_id}/keys
openapi: 3.1.0
info:
  description: >-
    Provider-neutral print catalog and prepared-media validation. This document
    covers only routes owned by the Go service; it deliberately excludes
    migration-proxied order lifecycle routes and all provider payloads.
  license:
    name: Proprietary
    url: https://github.com/SENTINELITE/Batch-Relay-Go/blob/main/README.md
  title: Batch Relay API
  version: 1.0.1
servers:
  - url: https://api.batchrelay.com
security: []
tags:
  - description: Service health and the public API description.
    name: System
  - description: Test Mode session creation and API credential entry points.
    name: Authentication
  - description: >-
      Provider-neutral canonical catalog resources and platform-owned semantic
      definitions.
    name: Catalog
  - description: Studio-scoped guest checkout-link management.
    name: Checkout links
  - description: >-
      One-way operational event messages. Alert emails contain no message body
      and recipients read messages after Batch Relay authentication.
    name: Studio messages
  - description: >-
      Explicit, reviewable sandbox-to-Live promotion plans for forms, catalog,
      and storefront configuration.
    name: Sandbox promotions
  - description: Provider-neutral validation, quoting, and order lifecycle operations.
    name: Print orders
  - description: Managed fulfillment asset ingestion and metadata.
    name: Managed assets
  - description: Studio-scoped original asset upload sessions and objects.
    name: Studio assets
  - description: Prepared and confirmed event roster team changes.
    name: Event team changes
  - description: Authenticated studio, event, and form-management operations.
    name: Studio management
  - description: >-
      Authenticated studio retail catalog management. Draft and publication
      lifecycles are explicit per product or package.
    name: Studio catalog
  - description: >-
      Authenticated singular storefront assortment management. PATCH atomically
      publishes a new immutable assortment revision; no storefront draft
      lifecycle exists yet.
    name: Storefront
  - description: Managed media used by the studio retail catalog.
    name: Studio catalog assets
  - description: Template rendering job creation and retrieval.
    name: Template renders
  - description: >-
      Published browser-side template packages and short-lived server proof
      renders. Preview artifacts are never fulfillment artwork.
    name: Browser previews
  - description: API account and credential administration.
    name: API accounts
paths:
  /v1/api-accounts/{account_id}/keys:
    parameters:
      - $ref: '#/components/parameters/ClientSurface'
      - $ref: '#/components/parameters/ClientVersion'
      - $ref: '#/components/parameters/InvocationMode'
      - $ref: '#/components/parameters/APIAccountID'
    post:
      tags:
        - API keys
      summary: Create a remote API key
      operationId: createAPIAccountKey
      parameters:
        - in: header
          name: Idempotency-Key
          required: true
          schema:
            maxLength: 256
            minLength: 1
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ManagedAPIKeyCreateRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagedAPIKeyIssueResult'
          description: API key and one-time secret
        '401':
          $ref: '#/components/responses/ManagementAuthenticationRequired'
        '403':
          $ref: '#/components/responses/APIAccountForbidden'
        '409':
          $ref: '#/components/responses/IdempotencyConflict'
        '503':
          $ref: '#/components/responses/ManagementUnavailable'
      security:
        - managementSession: []
components:
  parameters:
    ClientSurface:
      description: >-
        Untrusted optional analytics hint naming the calling client surface. It
        never affects authorization, routing, pricing, or behavior.
      in: header
      name: X-BatchRelay-Client-Surface
      required: false
      schema:
        maxLength: 100
        minLength: 1
        type: string
    ClientVersion:
      description: >-
        Untrusted optional analytics hint naming the calling client version. It
        never affects authorization, routing, pricing, or behavior.
      in: header
      name: X-BatchRelay-Client-Version
      required: false
      schema:
        maxLength: 100
        minLength: 1
        type: string
    InvocationMode:
      description: >-
        Untrusted optional analytics hint naming the invocation mode. It never
        affects authorization, routing, pricing, or behavior.
      in: header
      name: X-BatchRelay-Invocation-Mode
      required: false
      schema:
        maxLength: 100
        minLength: 1
        type: string
    APIAccountID:
      in: path
      name: account_id
      required: true
      schema:
        maxLength: 256
        minLength: 1
        type: string
  schemas:
    ManagedAPIKeyCreateRequest:
      additionalProperties: false
      properties:
        environment:
          enum:
            - test
            - live
          type: string
        expires_at:
          format: int64
          type: integer
        name:
          maxLength: 120
          minLength: 1
          type: string
        scopes:
          items:
            type: string
          maxItems: 8
          minItems: 1
          type: array
      required:
        - environment
        - name
        - scopes
      type: object
    ManagedAPIKeyIssueResult:
      additionalProperties: false
      properties:
        idempotent_replay:
          type: boolean
        key:
          $ref: '#/components/schemas/ManagedAPIKey'
        secret:
          description: >-
            Returned once on a non-replay create or rotation. Store securely;
            Batch Relay cannot retrieve it again.
          type: string
          writeOnly: true
      required:
        - key
        - idempotent_replay
      type: object
    ManagedAPIKey:
      additionalProperties: false
      properties:
        created_at:
          format: int64
          type: integer
        environment:
          enum:
            - test
            - live
          type: string
        expires_at:
          format: int64
          type: integer
        id:
          pattern: ^brk_
          type: string
        key_prefix:
          type: string
        last_used_at:
          format: int64
          type: integer
        masked_key:
          type: string
        name:
          type: string
        revoked_at:
          format: int64
          type: integer
        scopes:
          items:
            type: string
          type: array
        status:
          enum:
            - active
            - revoked
          type: string
        studio_grants:
          items:
            $ref: '#/components/schemas/ManagedStudioGrant'
          type: array
      required:
        - id
        - name
        - key_prefix
        - masked_key
        - environment
        - status
        - scopes
        - studio_grants
        - created_at
      type: object
    Error:
      additionalProperties: false
      properties:
        code:
          description: Stable machine-readable error code.
          type: string
        docs_url:
          format: uri
          type: string
        error:
          description: Backward-compatible human-readable error.
          type: string
        message:
          type: string
        request_id:
          type: string
      required:
        - error
        - code
        - message
        - docs_url
        - request_id
      type: object
    ManagedStudioGrant:
      additionalProperties: false
      properties:
        scopes:
          items:
            type: string
          type: array
        studio_id:
          type: string
      required:
        - studio_id
        - scopes
      type: object
  responses:
    ManagementAuthenticationRequired:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: A verified Batch Relay dashboard session is required.
    APIAccountForbidden:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: The authenticated user cannot operate this API account.
    IdempotencyConflict:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: The idempotency key has already been used with a different request.
    ManagementUnavailable:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        The management auth, account, or billing command bridge is not
        configured or temporarily unavailable.
  securitySchemes:
    managementSession:
      bearerFormat: Clerk session token
      description: >-
        Verified Batch Relay dashboard session token. This is distinct from a
        scoped Batch Relay API key.
      scheme: bearer
      type: http

````