> ## 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.

# Create a browser key

> Creates a browser public key for your application, the `browserKey` baselayer.js sends. An application has at most 2 keys, so a replacement can be deployed before the old key is deleted; at the limit, delete 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: Create a browser key
      description: >-
        Creates a browser public key for your application, the `browserKey`
        baselayer.js sends. An application has at most 2 keys, so a replacement
        can be deployed before the old key is deleted; at the limit, delete 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.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1.AcceptanceBrowserKey'
            application/vnd.baselayer.v1+json:
              schema:
                $ref: '#/components/schemas/v1.AcceptanceBrowserKey'
          headers:
            Location:
              description: The new key.
              schema:
                type: string
        '409':
          description: The application already has the maximum number of keys.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
                title: BrowserKeyLimitReached
                description: >-
                  The application already has the maximum number of browser
                  keys; delete one first. See metadata for the limit.
                examples:
                  - type: browser_key_limit_reached
                    code: 7250
                    message: >-
                      The application already has the maximum number of browser
                      keys; delete 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 create.
      properties:
        name:
          description: What the key is for, such as the site it ships on.
          maxLength: 100
          minLength: 1
          title: Name
          type: string
      required:
        - name
      title: AcceptanceBrowserKeyRequest (v1)
      type: object
    v1.AcceptanceBrowserKey:
      description: 'A browser public key, with the key itself: it ships in page source.'
      properties:
        browser_key_id:
          description: The key's id.
          format: uuid
          title: Browser Key Id
          type: string
        browser_key:
          description: >-
            The key, for baselayer.js's `browserKey`. It is public, like a
            publishable key: `allowed_origins` stops its use elsewhere.
          title: Browser Key
          type: string
        name:
          description: What the key is for.
          title: Name
          type: string
        environment:
          $ref: '#/components/schemas/v1.ApplicationType'
          description: The application's environment.
        created_at:
          description: When the key was created.
          format: date-time
          title: Created At
          type: string
        created_by:
          $ref: '#/components/schemas/v1.AcceptanceActor'
          description: Who created it.
      required:
        - browser_key_id
        - browser_key
        - name
        - environment
        - created_at
        - created_by
      title: AcceptanceBrowserKey (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 person 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.AcceptanceActor:
      description: Who made a policy version or a browser key, as they were named then.
      properties:
        type:
          $ref: '#/components/schemas/v1.ActedByKind'
          description: >-
            `USER` for a console user, `API_KEY` for an API key,
            `SIGNUP_SESSION` for a person signing up with no account yet. It is
            the platform-wide `ActedByKind`, so acceptance names actors with the
            same values as every other route; policy versions and browser keys
            are made by `USER` or `API_KEY` today. The set may grow.
        label:
          description: >-
            The user's first and last name or the API key's name, as they were
            when they acted.
          title: Label
          type: string
      required:
        - type
        - label
      title: AcceptanceActor (v1)
      type: object
    v1.ActedByKind:
      description: |-
        Who acted on a record: a console user, an API key, or a person signing
        up with no account yet.
      enum:
        - USER
        - API_KEY
        - SIGNUP_SESSION
      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.