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

# List package grants

Lists the customer Workspaces that hold a grant to your Package, newest grant first: each Workspace ID, the version it redeemed, the Offer and redemption time that granted it, and when. Use the Workspace ID to revoke a grant. Requires package.grants.list in the Package's Workspace.

`GET https://api.akua.dev/v1/packages/{id}/grants`

## Authorizations

- `Authorization: Bearer <token>` (BearerAuth): Bearer token for the authenticated caller.

## Headers

- `akua-context` (string): Optional workspace/scope context for the request. Carries a single workspace wire id (`ws_…`) today. Only needed for broad tokens - a workspace-owned token implies its workspace. Required string length: `1 - 53`. Example: `"ws_j572abc123def4"`.

## Path Parameters

- `id` (string, required): Package ID. Required string length: `1 - 54`. Example: `"pkg_j572abc123def456"`.

## Query Parameters

- `cursor` (string): Pagination cursor from a previous response's `next_cursor`. Maximum string length: `512`.
- `limit` (integer, default 50): Grants per page (1-100, default 50). Required range: `1 <= x <= 100`.

## Response

### 200: Grants, newest first

`application/json`: `PackageGrantList`

- `data` (object[], required)
  - `workspace_id` (string, required): The customer Workspace that holds the grant. Required string length: `2 - 53`. Example: `"ws_9177x8shcx0niswcn"`.
  - `version` (string, required): The version the customer redeemed. The grant covers every published version of the Package. Required string length: `1 - 128`. Pattern: `^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$`.
  - `offer_id` (string | null, required): The Offer whose redemption granted access, or null for a grant made before Akua recorded it. Required string length: `4 - 56`.
  - `redeemed_at` (integer | null, required): When the customer redeemed the Offer (Unix seconds), or null like offer_id. Unix timestamp (seconds). Required range: `x >= 0`.
  - `granted_at` (integer, required): Unix timestamp (seconds). Required range: `x >= 0`.
- `has_more` (boolean, required): True if more grants exist after this page.
- `next_cursor` (string | null, required): Opaque cursor for the next page, or null if no more pages.

### 400: The request is malformed.

`application/json`: `ApiBadRequest`

- `_tag` (enum<string>, required): Available options: `"Validation"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 401: Missing, invalid or expired credential.

`application/json`: `ApiUnauthorized`

- `_tag` (enum<string>, required): Available options: `"Unauthorized"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 403: The credential may not act in this workspace.

`application/json`: `ApiForbidden`

- `_tag` (enum<string>, required): Available options: `"Forbidden"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 404: The resource was not found in this workspace.

`application/json`: `ApiNotFound`

- `_tag` (enum<string>, required): Available options: `"NotFound"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

## Example request

```bash
curl --request GET \
  --url 'https://api.akua.dev/v1/packages/pkg_j572abc123def456/grants' \
  --header 'Authorization: Bearer <token>'
```

## Example response

`200` `application/json`

```json
{
  "data": [
    {
      "workspace_id": "ws_9177x8shcx0niswcn",
      "version": "<string>",
      "offer_id": "offer_j572abc123def456",
      "redeemed_at": 123,
      "granted_at": 123
    }
  ],
  "has_more": true,
  "next_cursor": "<string>"
}
```
