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

# Replace your application's registered audiences

> Stores the body's audiences, sorted, in place of the current ones. Each must already be canonical: a bare lowercase domain or `https://<host>`. Send the `ETag` of the list you edited as `If-Match`; if another write changed it first, the replace is refused and nothing changes. The change applies to presentations checked after it.



## OpenAPI

````yaml /api-reference/openapi.json put /acceptance/audiences
openapi: 3.1.0
info:
  title: baselayer-api-service
  version: 0.1.0
servers:
  - url: https://api.baselayer.com/
security: []
paths:
  /acceptance/audiences:
    put:
      tags:
        - Acceptance
      summary: Replace your application's registered audiences
      description: >-
        Stores the body's audiences, sorted, in place of the current ones. Each
        must already be canonical: a bare lowercase domain or `https://<host>`.
        Send the `ETag` of the list you edited as `If-Match`; if another write
        changed it first, the replace is refused and nothing changes. The change
        applies to presentations checked after it.
      operationId: acceptance_audiences_replace
      parameters:
        - name: if-match
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: The `ETag` of the list the body was edited from.
            title: If-Match
          description: The `ETag` of the list the body was edited from.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v1.AcceptanceAudiencesRequest'
          application/vnd.baselayer.v1+json:
            schema:
              $ref: '#/components/schemas/v1.AcceptanceAudiencesRequest'
      responses:
        '200':
          description: The stored audiences.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1.AcceptanceAudiences'
            application/vnd.baselayer.v1+json:
              schema:
                $ref: '#/components/schemas/v1.AcceptanceAudiences'
          headers:
            ETag:
              description: >-
                A hash of the sorted audiences, quoted; send it back as
                `If-Match` to replace them.
              schema:
                type: string
        '404':
          description: The application no longer exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
                title: ResourceNotFound
                description: Could not locate the resource for the given URI.
                examples:
                  - type: resource_not_found
                    code: 1
                    message: Could not locate the resource for the given URI.
                    metadata: {}
        '412':
          description: '`If-Match` does not name the current list.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
                title: AudiencesStale
                description: >-
                  The audiences have changed since the version you edited. Read
                  them again and reapply your change.
                examples:
                  - type: audiences_stale
                    code: 7232
                    message: >-
                      The audiences have changed since the version you edited.
                      Read them again and reapply your change.
                    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: {}
        '428':
          description: The request has no `If-Match`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
                title: IfMatchRequired
                description: >-
                  A replace needs an If-Match header naming the version you
                  edited.
                examples:
                  - type: if_match_required
                    code: 7220
                    message: >-
                      A replace needs an If-Match header naming the version you
                      edited.
                    metadata: {}
      security:
        - APIKeyHeader: []
components:
  schemas:
    v1.AcceptanceAudiencesRequest:
      additionalProperties: false
      description: The audiences a replace stores, sorted, in place of the current ones.
      properties:
        audiences:
          description: >-
            Canonical audiences, each exactly as canonicalized: a bare lowercase
            domain or `https://<host>`. Stored and returned sorted.
          items:
            maxLength: 253
            type: string
          maxItems: 50
          title: Audiences
          type: array
      required:
        - audiences
      title: AcceptanceAudiencesRequest (v1)
      type: object
    v1.AcceptanceAudiences:
      description: The audiences a key-binding JWT's `aud` must be one of.
      properties:
        audiences:
          description: The registered audiences, sorted ascending.
          items:
            type: string
          title: Audiences
          type: array
      required:
        - audiences
      title: AcceptanceAudiences (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.
  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.