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

# POST /admin/api/api-keys/batch



## OpenAPI

````yaml /generated/openapi.json post /admin/api/api-keys/batch
openapi: 3.1.0
info:
  description: >-
    Forwarding, management, portal and OAuth APIs generated from Rust types.
    Input and output schemas preserve their respective Serde contracts.
    Streaming events and WebSocket messages are documented alongside HTTP
    payloads.
  title: GPROXY HTTP API
  version: 4.2.1
servers: []
security:
  - bearer: []
  - anthropicKey: []
  - googleKey: []
  - queryKey: []
paths:
  /admin/api/api-keys/batch:
    post:
      tags:
        - Management
      summary: POST /admin/api/api-keys/batch
      parameters:
        - description: Administrative scope selected by the caller.
          in: header
          name: x-gproxy-admin-scope
          required: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              items:
                $ref: '#/components/schemas/Input_BatchItem2'
              type: array
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  anyOf:
                    - $ref: '#/components/schemas/Output_ApiKeyDto'
                    - type: 'null'
                type: array
          description: Success
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Output_Envelope'
          description: Gateway error
      security:
        - consoleSession: []
        - bearer: []
        - anthropicKey: []
        - googleKey: []
components:
  schemas:
    Input_BatchItem2:
      description: |-
        One step of a batch write. Every item of one batch lands in a single
        revision commit: either all of them are durable or none is.
      oneOf:
        - additionalProperties: false
          properties:
            create:
              $ref: '#/components/schemas/Input_ApiKeyWrite'
          required:
            - create
          type: object
        - additionalProperties: false
          properties:
            update:
              $ref: '#/components/schemas/Input_BatchPatch2'
          required:
            - update
          type: object
        - additionalProperties: false
          properties:
            delete:
              type: string
          required:
            - delete
          type: object
    Output_ApiKeyDto:
      properties:
        enabled:
          type: boolean
        expiresAtMs:
          format: int64
          type:
            - integer
            - 'null'
        hasSecret:
          description: |-
            Whether the instance retained a sealed copy of the key text, i.e.
            whether `reveal` can answer. The bytes themselves have no field.
          type: boolean
        id:
          type: string
        kind:
          description: >-
            `user` or `oauth`. An `oauth` key is a grant's internal key and is
            not

            a bearer credential; it is listed so an operator can see it, never

            created or revealed through this family.
          type: string
        management:
          description: Whether the key may manage; see `api_keys.management`.
          type: boolean
        name:
          type: string
        organizationId:
          type:
            - string
            - 'null'
        prefix:
          description: >-
            The first eight characters of the key body, for recognising a key in
            a

            list. Not a secret and not enough of one to be useful.
          type: string
        teamId:
          type:
            - string
            - 'null'
        userId:
          type: string
      required:
        - id
        - userId
        - name
        - prefix
        - kind
        - organizationId
        - teamId
        - expiresAtMs
        - enabled
        - management
        - hasSecret
      type: object
    Output_Envelope:
      properties:
        error:
          $ref: '#/components/schemas/Output_EnvelopeBody'
      required:
        - error
      type: object
    Input_ApiKeyWrite:
      properties:
        budget:
          anyOf:
            - $ref: '#/components/schemas/Input_ApiKeyBudgetWrite'
            - type: 'null'
          default: null
          description: Optional initial cost budget, committed atomically with the key.
        enabled:
          default: null
          type:
            - boolean
            - 'null'
        expiresAtMs:
          default: null
          format: int64
          type:
            - integer
            - 'null'
        id:
          default: null
          type:
            - string
            - 'null'
        management:
          default: null
          description: |-
            Let the key manage: `/admin/api`, and the portal's key and password
            operations. Off by default.
          type:
            - boolean
            - 'null'
        name:
          type: string
        organizationId:
          default: null
          description: >-
            The binding that decides the budget chain, the permission subject
            and

            the credential-visibility boundary at once. It is set here, once,
            and

            never taken from a request header.
          type:
            - string
            - 'null'
        retainSecret:
          default: null
          description: >-
            Keep a sealed copy of the key text so it can be revealed later.
            False

            by default: a key the instance cannot reproduce is a key a database

            leak does not hand over.
          type:
            - boolean
            - 'null'
        teamId:
          default: null
          type:
            - string
            - 'null'
        userId:
          type: string
      required:
        - userId
        - name
      type: object
    Input_BatchPatch2:
      properties:
        id:
          type: string
        patch:
          $ref: '#/components/schemas/Input_ApiKeyPatch'
      required:
        - id
        - patch
      type: object
    Output_EnvelopeBody:
      properties:
        code:
          type: string
        message:
          type: string
      required:
        - code
        - message
      type: object
    Input_ApiKeyBudgetWrite:
      description: >-
        A key's initial cost budget. Ownership and metric are assigned by the
        server.
      properties:
        anchorAtMs:
          default: null
          format: int64
          type:
            - integer
            - 'null'
        limitValue:
          type: string
        modelPattern:
          default: null
          type:
            - string
            - 'null'
        period:
          default: null
          type:
            - string
            - 'null'
        periodSeconds:
          default: null
          format: int64
          type:
            - integer
            - 'null'
        windowKey:
          default: null
          type:
            - string
            - 'null'
      required:
        - limitValue
      type: object
    Input_ApiKeyPatch:
      properties:
        enabled:
          default: null
          type:
            - boolean
            - 'null'
        expiresAtMs:
          default: null
          format: int64
          type:
            - integer
            - 'null'
        management:
          default: null
          type:
            - boolean
            - 'null'
        name:
          default: null
          type:
            - string
            - 'null'
        organizationId:
          default: null
          type:
            - string
            - 'null'
        teamId:
          default: null
          type:
            - string
            - 'null'
      type: object
  securitySchemes:
    bearer:
      scheme: bearer
      type: http
    anthropicKey:
      in: header
      name: x-api-key
      type: apiKey
    googleKey:
      in: header
      name: x-goog-api-key
      type: apiKey
    queryKey:
      in: query
      name: key
      type: apiKey
    consoleSession:
      in: cookie
      name: gproxy_session
      type: apiKey

````

## Related topics

- [POST /admin/api/permissions/batch](https://gproxy.leenhawk.com/api-reference/management/post-adminapipermissionsbatch.md)
- [POST /admin/api/quotas/batch](https://gproxy.leenhawk.com/api-reference/management/post-adminapiquotasbatch.md)
- [POST /admin/api/api-keys](https://gproxy.leenhawk.com/api-reference/management/post-adminapiapi-keys.md)
- [POST /admin/api/rate-limits/batch](https://gproxy.leenhawk.com/api-reference/management/post-adminapirate-limitsbatch.md)
- [POST /admin/api/rules/batch](https://gproxy.leenhawk.com/api-reference/management/post-adminapirulesbatch.md)


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