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

# Rotate a buyer-agent API-key credential



## OpenAPI

````yaml /openapi/v3.yaml post /api/v2/buyer-agent-principals/rotate
openapi: 3.1.0
info:
  title: Semicola Exchange platform API
  version: 3.0.0-preview
  description: >-
    Platform endpoints of Semicola: sign-in, signup and OAuth for MCP clients,
    accounts, members and keys, billing, notifications, the Semi assistant (chat
    stream, confirmations, conversations), the MCP App widget host and realtime
    feeds. Typed agent tools live on the MCP server at /mcp/v3.
servers:
  - url: https://api.semicola.com
security:
  - bearerAuth: []
  - sessionCookie: []
tags:
  - name: Auth
  - name: Signup
  - name: OAuth
  - name: Accounts
  - name: Members
  - name: API Keys
  - name: Buyer Agent Principals
  - name: Asks
  - name: Connected Apps
  - name: Onboarding
  - name: Billing
  - name: AI Usage
  - name: Notifications
  - name: Assistant
  - name: MCP Apps
  - name: Realtime
  - name: Demo
paths:
  /api/v2/buyer-agent-principals/rotate:
    post:
      tags:
        - Buyer Agent Principals
      summary: Rotate a buyer-agent API-key credential
      operationId: postBuyerAgentPrincipalsRotate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                type:
                  type: string
                  const: api_key
                currentServiceTokenId:
                  type: string
                  minLength: 1
              required:
                - type
                - currentServiceTokenId
              additionalProperties: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    anyOf:
                      - type: object
                        properties:
                          principal:
                            type: object
                            properties:
                              principalId:
                                type: string
                              principalKind:
                                type: string
                                const: buyer_agent
                              displayName:
                                type: string
                              lifecycleState:
                                type: string
                                enum:
                                  - active
                                  - suspended
                                  - retired
                              canonicalAgentUrl:
                                type:
                                  - string
                                  - 'null'
                              authority:
                                type: object
                                properties:
                                  account:
                                    type: boolean
                                    const: false
                                  spend:
                                    type: boolean
                                    const: false
                                  payment:
                                    type: boolean
                                    const: false
                                  terms:
                                    type: boolean
                                    const: false
                                required:
                                  - account
                                  - spend
                                  - payment
                                  - terms
                                additionalProperties: false
                              access:
                                type: object
                                properties:
                                  revision:
                                    type: integer
                                    minimum: -9007199254740991
                                    maximum: 9007199254740991
                                  advertisers:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        advertiserId:
                                          type: integer
                                          minimum: -9007199254740991
                                          maximum: 9007199254740991
                                        advertiserName:
                                          type: string
                                        role:
                                          type: string
                                          enum:
                                            - READ
                                            - READ_WRITE
                                      required:
                                        - advertiserId
                                        - advertiserName
                                        - role
                                      additionalProperties: false
                                required:
                                  - revision
                                  - advertisers
                                additionalProperties: false
                              credentials:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    credentialType:
                                      type: string
                                      enum:
                                        - api_key
                                        - m2m
                                    binding:
                                      type: string
                                      enum:
                                        - active
                                        - retired
                                    serviceTokenId:
                                      type:
                                        - string
                                        - 'null'
                                    keyPrefix:
                                      type:
                                        - string
                                        - 'null'
                                    keyName:
                                      type:
                                        - string
                                        - 'null'
                                    subject:
                                      type:
                                        - string
                                        - 'null'
                                    lastUsedAt:
                                      anyOf:
                                        - type: string
                                          format: date-time
                                          pattern: >-
                                            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                                        - type: 'null'
                                    createdAt:
                                      type: string
                                      format: date-time
                                      pattern: >-
                                        ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                                    retiredAt:
                                      anyOf:
                                        - type: string
                                          format: date-time
                                          pattern: >-
                                            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                                        - type: 'null'
                                  required:
                                    - credentialType
                                    - binding
                                    - lastUsedAt
                                    - createdAt
                                    - retiredAt
                                  additionalProperties: false
                              createdAt:
                                type: string
                                format: date-time
                                pattern: >-
                                  ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                            required:
                              - principalId
                              - principalKind
                              - displayName
                              - lifecycleState
                              - canonicalAgentUrl
                              - authority
                              - access
                              - credentials
                              - createdAt
                            additionalProperties: false
                          credential:
                            type: object
                            properties:
                              credentialType:
                                type: string
                                enum:
                                  - api_key
                                  - m2m
                              subject:
                                type:
                                  - string
                                  - 'null'
                              clientId:
                                type: string
                              clientSecret:
                                type:
                                  - string
                                  - 'null'
                              serviceTokenId:
                                type: string
                              keyPrefix:
                                type: string
                              secret:
                                type: string
                              tokenEndpoint:
                                type: string
                              grantType:
                                type: string
                                const: client_credentials
                            required:
                              - credentialType
                            additionalProperties: false
                        required:
                          - principal
                          - credential
                        additionalProperties: false
                      - type: 'null'
                  error:
                    anyOf:
                      - type: object
                        properties:
                          code:
                            type: string
                          message:
                            type: string
                          field:
                            type: string
                          details: {}
                        required:
                          - code
                          - message
                        additionalProperties: false
                      - type: 'null'
                required:
                  - data
                  - error
                additionalProperties: false
        default:
          description: >-
            Error envelope `{data: null, error: {code, message, field?,
            details?}}`.
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key or OAuth access token.
    sessionCookie:
      type: apiKey
      in: cookie
      name: sc_session

````