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

# Decline Usage Request

> Decline a member's usage request that is still waiting

List members' requests for more usage, read one request, and decline a request that is still waiting. There is no webhook. Poll the list.

To approve a request, raise that member's plan or extra usage budget and pass `usageRequestId` on that write. See [Billing Users](https://docs.langdock.com/en/developer/billing-api/set-user-plan.md).

The calls use the workspace API key's `BILLING_API` scope. The decline runs as the key's service account owner.

## Base URL

```
https://api.langdock.com/billing/v1/bring-your-own-keys/usage-requests/{requestId}/dismiss
```

> [!WARNING]
>
> **Dedicated deployments**
>
> Replace `api.langdock.com` with `<your-deployment-url>/api/public` in all requests.

## Prerequisites

* **API key** with the `BILLING_API` scope
* The key owner is a service account that has not been deleted and has an active Admin membership
* `USER_MANAGEMENT_API` on the same key when you need `email` or `name`

## Decline a request

`POST /usage-requests/{requestId}/dismiss` takes no body. The response is the request with `status` `dismissed` and `resolution` `dismissed`.

A request that is no longer pending returns `409` with `code` `USAGE_REQUEST_NOT_PENDING`. The current status is in `details.status`. Nothing changes. A decline and a named plan or budget write for the same request cannot both succeed. The call that loses returns `409` and changes nothing.

> [!NOTE]
>
> Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on [API Key Best Practices](https://docs.langdock.com/en/admin/ai-adoption-and-rollout/best-practices/api-key-best-practices.md).


## OpenAPI

````yaml POST /billing/v1/bring-your-own-keys/usage-requests/{requestId}/dismiss
openapi: 3.0.0
info:
  title: Langdock API
  version: 3.0.0
servers:
  - url: https://api.langdock.com
    description: Production
security:
  - bearerAuth: []
paths:
  /billing/v1/bring-your-own-keys/usage-requests/{requestId}/dismiss:
    parameters:
      - $ref: '#/components/parameters/RequestId'
    post:
      tags:
        - Usage requests
      summary: Dismiss a usage request
      description: >-
        Declines a pending request as the key's service account. To approve,
        raise the member's limit or plan with the user PUT endpoints instead.
      operationId: dismissByokBillingUsageRequest
      responses:
        '200':
          description: The dismissed request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageRequest'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '405':
          $ref: '#/components/responses/MethodNotAllowed'
        '409':
          $ref: '#/components/responses/UsageRequestConflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  parameters:
    RequestId:
      in: path
      name: requestId
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    UsageRequest:
      type: object
      additionalProperties: false
      required:
        - id
        - userId
        - status
        - createdAt
        - resolvedAt
        - resolution
        - resolvedByUserId
      properties:
        id:
          type: string
          format: uuid
        userId:
          type: string
          format: uuid
        email:
          type: string
          format: email
          description: Present only when the key also has the USER_MANAGEMENT_API scope.
        name:
          type: string
          nullable: true
          description: Present only when the key also has the USER_MANAGEMENT_API scope.
        status:
          type: string
          enum:
            - pending
            - resolved
            - dismissed
        createdAt:
          type: string
          format: date-time
        resolvedAt:
          type: string
          format: date-time
          nullable: true
        resolution:
          type: string
          nullable: true
          enum:
            - increased_limit
            - upgraded_plan
            - dismissed
            - null
          description: How the request was answered; null while pending.
        resolvedByUserId:
          type: string
          format: uuid
          nullable: true
          description: Admin or service account that answered the request.
    Error:
      type: object
      additionalProperties: false
      required:
        - message
        - code
      properties:
        message:
          type: string
        code:
          type: string
        details:
          type: object
          additionalProperties: true
          description: >-
            Optional structured details specific to the error code, such as
            userIds for invalid bulk members.
    ModeMismatchError:
      type: object
      additionalProperties: false
      required:
        - message
        - code
        - details
      properties:
        message:
          type: string
        code:
          type: string
          enum:
            - BILLING_MODE_MISMATCH
        details:
          type: object
          additionalProperties: false
          required:
            - mode
          properties:
            mode:
              type: string
              enum:
                - ai-models-included
                - bring-your-own-keys
    UsageRequestNotPendingError:
      type: object
      additionalProperties: false
      required:
        - message
        - code
        - details
      properties:
        message:
          type: string
        code:
          type: string
          enum:
            - USAGE_REQUEST_NOT_PENDING
            - USAGE_REQUEST_NOT_ANSWERED
        details:
          type: object
          additionalProperties: false
          required:
            - status
          properties:
            status:
              type: string
              enum:
                - pending
                - resolved
                - dismissed
  responses:
    BadRequest:
      description: >-
        Invalid body/query, unknown fields, empty PATCH, invalid limit, invalid
        bulk member IDs, or a cursor outside this workspace (INVALID_CURSOR).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid authentication.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: >-
        Missing Billing scope, personal key, unavailable feature, missing active
        service-account Admin authority, or email filter without the
        USER_MANAGEMENT_API scope.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: >-
        Resource not in this workspace, inactive/non-human user, privacy-hidden
        agent, usage request not found for that member, or endpoint unavailable
        in this mode.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    MethodNotAllowed:
      description: Unsupported HTTP method.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UsageRequestConflict:
      description: >-
        Workspace mode differs from the requested mode (BILLING_MODE_MISMATCH),
        the usage request is no longer pending (USAGE_REQUEST_NOT_PENDING,
        details.status holds its current status), or the write does not answer
        the named usage request (USAGE_REQUEST_NOT_ANSWERED).
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/ModeMismatchError'
              - $ref: '#/components/schemas/UsageRequestNotPendingError'
    TooManyRequests:
      description: API rate limit exceeded.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: API key as Bearer token. Format "Bearer YOUR_API_KEY"

````

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