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

# Mint a browser key

> Mints a browser public key for your application, the `browserKey` baselayer.js sends. The key is in this response only: Baselayer cannot show it again, so store it now. An application has at most 2 live keys, so a rotation can overlap; at the limit, revoke a key first. Baselayer accepts a new key usually within about 20 seconds, and within about 5 minutes once publishing is healthy.



## OpenAPI

````yaml /api-reference/openapi.json post /acceptance/browser_keys
openapi: 3.1.0
info:
  title: baselayer-api-service
  version: 0.1.0
servers:
  - url: https://api.baselayer.com/
security: []
paths:
  /acceptance/browser_keys:
    post:
      tags:
        - Acceptance
      summary: Mint a browser key
      description: >-
        Mints a browser public key for your application, the `browserKey`
        baselayer.js sends. The key is in this response only: Baselayer cannot
        show it again, so store it now. An application has at most 2 live keys,
        so a rotation can overlap; at the limit, revoke a key first. Baselayer
        accepts a new key usually within about 20 seconds, and within about 5
        minutes once publishing is healthy.
      operationId: acceptance_browser_keys_create
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v1.AcceptanceBrowserKeyRequest'
          application/vnd.baselayer.v1+json:
            schema:
              $ref: '#/components/schemas/v1.AcceptanceBrowserKeyRequest'
      responses:
        '201':
          description: The key, with `browser_key`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1.AcceptanceBrowserKeyMinted'
            application/vnd.baselayer.v1+json:
              schema:
                $ref: '#/components/schemas/v1.AcceptanceBrowserKeyMinted'
          headers:
            Location:
              description: The new key.
              schema:
                type: string
        '409':
          description: The application already has the maximum number of live keys.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
                title: BrowserKeyLimitReached
                description: >-
                  The application already has the maximum number of live browser
                  keys; revoke one first. See metadata for the limit.
                examples:
                  - type: browser_key_limit_reached
                    code: 7250
                    message: >-
                      The application already has the maximum number of live
                      browser keys; revoke one first. See metadata for the
                      limit.
                    metadata: {}
        '422':
          description: The request is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
                title: ValidationFailed
                description: The request is invalid.
                examples:
                  - type: validation_failed
                    code: 7112
                    message: The request is invalid.
                    metadata: {}
      security:
        - APIKeyHeader: []
components:
  schemas:
    v1.AcceptanceBrowserKeyRequest:
      additionalProperties: false
      description: A browser key to mint.
      properties:
        label:
          description: What the key is for, such as the site it ships on.
          maxLength: 100
          minLength: 1
          title: Label
          type: string
      required:
        - label
      title: AcceptanceBrowserKeyRequest (v1)
      type: object
    v1.AcceptanceBrowserKeyMinted:
      description: 'A key just minted: the only response that carries the key itself.'
      properties:
        browser_key_id:
          description: The key's id.
          format: uuid
          title: Browser Key Id
          type: string
        label:
          description: What the key is for.
          title: Label
          type: string
        environment:
          $ref: '#/components/schemas/v1.ApplicationType'
          description: The application's environment.
        created_at:
          description: When the key was minted.
          format: date-time
          title: Created At
          type: string
        created_by:
          $ref: '#/components/schemas/v1.ActedBy'
          description: Who minted it.
        revoked_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          default: null
          description: When it was revoked; null while it is live.
          title: Revoked At
        browser_key:
          description: >-
            The key, for baselayer.js's `browserKey`. Shown only in this
            response; Baselayer stores its sha256, so it cannot be shown again.
          title: Browser Key
          type: string
      required:
        - browser_key_id
        - label
        - environment
        - created_at
        - created_by
        - browser_key
      title: AcceptanceBrowserKeyMinted (v1)
      type: object
    Error:
      properties:
        type:
          type: string
          title: Type
          description: >-
            Stable snake_case name of the error. Branch on this, never on
            `message`.
        code:
          type: integer
          title: Code
          description: Integer catalog code of the error.
        message:
          type: string
          title: Message
          description: For a human reading a log; not stable and not localized.
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
          description: Context documented per `type`.
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Request Id
          description: The `X-Request-ID` of the failed request.
      type: object
      required:
        - type
        - code
        - message
      title: Error
      description: The one body of every error a KYA route answers.
    v1.ApplicationType:
      enum:
        - sandbox
        - production
      title: ApplicationType
      type: string
    v1.ActedBy:
      description: |-
        Who acted on a record, as they were named when they acted: the one actor
        shape every route answers.
      properties:
        kind:
          $ref: '#/components/schemas/v1.ActedByKind'
          description: '`USER` for a console user, `API_KEY` for a key.'
        label:
          description: >-
            The user's first and last name or the API key's name, as they were
            when they acted; never rewritten by a later rename or deletion.
          title: Label
          type: string
      required:
        - kind
        - label
      title: ActedBy (v1)
      type: object
    v1.ActedByKind:
      description: 'Who acted on a record: a console user or an API key.'
      enum:
        - USER
        - API_KEY
      title: ActedByKind
      type: string
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````

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