> For the complete documentation index, see [llms.txt](https://docs.truedat.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.truedat.io/v8.12/api-integrations/data-catalog-data-lineage-and-grants-apis/grants.md).

# Grants

## Create grant

> Creates a grant for the target data structure.\
> \
> Requires the \*\*'Manage grants'\*\* permission on the target structure.\
> \
> ID of the user receiving the grant (\`user\_id\`) is required but \`start\_date\`, \`end\_date\`, \`source\_user\_name\` and \`detail\` are optional.\
> The grant is created with the provided dates (if any). If \`start\_date\` is omitted, the grant is effective immediately.\
> \
> The \`detail\` field is a free‑form JSON object for additional metadata.<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/data_structures/{data_structure_id}/grants":{"post":{"description":"Creates a grant for the target data structure.\n\nRequires the **'Manage grants'** permission on the target structure.\n\nID of the user receiving the grant (`user_id`) is required but `start_date`, `end_date`, `source_user_name` and `detail` are optional.\nThe grant is created with the provided dates (if any). If `start_date` is omitted, the grant is effective immediately.\n\nThe `detail` field is a free‑form JSON object for additional metadata.\n","operationId":"TdDdWeb.GrantController.create","parameters":[{"description":"Data Structure external ID","in":"path","name":"data_structure_id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantCreateRequest"}}},"description":"Grant create payload","required":false},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantCreateResponse"}}},"description":"Grant created"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdForbiddenResponse"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdNotFoundMessageResponse"}}},"description":"Not found"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnprocessableEntityObjectResponse"}}},"description":"Unprocessable Entity"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Create grant","tags":["Grants"]}}},"components":{"schemas":{"GrantCreateRequest":{"additionalProperties":false,"properties":{"grant":{"additionalProperties":false,"description":"Grant attributes. Provide either user fields or group fields (XOR).","properties":{"detail":{"additionalProperties":true,"description":"Additional details (optional)","type":"object"},"end_date":{"description":"Grant end date (optional)","format":"date","type":"string"},"source_group_name":{"description":"External source group name (optional)","type":"string"},"source_user_name":{"description":"Source user name (optional)","type":"string"},"start_date":{"description":"Grant start date (optional)","format":"date","type":"string"},"user_group_alias":{"description":"User group alias (resolved to user_group_id)","type":"string"},"user_group_id":{"description":"User group ID","nullable":true,"type":"integer"},"user_group_name":{"description":"User group name (resolved to user_group_id)","type":"string"},"user_id":{"description":"User ID","nullable":true,"type":"integer"}},"type":"object"}},"required":["grant"],"title":"GrantCreateRequest","type":"object"},"GrantCreateResponse":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/Grant"}},"required":["data"],"title":"GrantCreateResponse","type":"object"},"Grant":{"additionalProperties":false,"properties":{"data_structure":{"$ref":"#/components/schemas/GrantDataStructure"},"data_structure_version":{"$ref":"#/components/schemas/GrantDataStructureVersion"},"detail":{"additionalProperties":true,"default":{},"type":"object"},"end_date":{"format":"date","nullable":true,"type":"string"},"external_ref":{"nullable":true,"type":"string"},"id":{"type":"integer"},"inserted_at":{"format":"date-time","type":"string"},"pending_removal":{"default":false,"type":"boolean"},"source_group_name":{"nullable":true,"type":"string"},"source_user_name":{"nullable":true,"type":"string"},"start_date":{"format":"date","nullable":true,"type":"string"},"system":{"additionalProperties":true,"nullable":true,"type":"object"},"updated_at":{"format":"date-time","type":"string"},"user":{"additionalProperties":true,"nullable":true,"type":"object"},"user_group":{"additionalProperties":false,"nullable":true,"properties":{"alias":{"nullable":true,"type":"string"},"id":{"type":"integer"},"name":{"nullable":true,"type":"string"},"users":{"items":{"additionalProperties":false,"properties":{"full_name":{"nullable":true,"type":"string"},"id":{"type":"integer"},"user_name":{"nullable":true,"type":"string"}},"type":"object"},"nullable":true,"type":"array"}},"type":"object"},"user_group_id":{"nullable":true,"type":"integer"},"user_id":{"nullable":true,"type":"integer"}},"required":["id"],"title":"Grant","type":"object"},"GrantDataStructure":{"additionalProperties":false,"properties":{"external_id":{"nullable":true,"type":"string"},"id":{"type":"integer"},"name":{"nullable":true,"type":"string"},"system":{"nullable":true,"properties":{"external_id":{"type":"string"},"id":{"type":"integer"},"name":{"type":"string"}},"type":"object"},"system_id":{"nullable":true,"type":"integer"},"type":{"nullable":true,"type":"string"}},"title":"GrantDataStructure","type":"object"},"GrantDataStructureVersion":{"additionalProperties":true,"properties":{"ancestry":{"items":{"type":"integer"},"nullable":true,"type":"array"},"id":{"nullable":true,"type":"integer"},"name":{"nullable":true,"type":"string"},"path":{"items":{"type":"integer"},"nullable":true,"type":"array"},"version":{"nullable":true,"type":"integer"}},"title":"GrantDataStructureVersion","type":"object"},"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdForbiddenResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdForbiddenResponse","type":"object"},"TdDdNotFoundMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdNotFoundMessageResponse","type":"object"},"TdDdUnprocessableEntityObjectResponse":{"additionalProperties":false,"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnprocessableEntityObjectResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## Search grants for current user

> Searches grants owned by the current user, not all visible grants.\
> \
> Supports pagination, scrolling (\`scroll\` + \`scroll\_id\`), and filtering (\`filters\`). \`page\` defaults to \`0\` and \`size\` defaults to \`20\`. Sorting is by relevance unless specified via \`sort\` parameter.\
> \
> The response includes a \`x-total-count\` header.\
> \
> Soft‑deleted grants are excluded by default.\
> \
> Requires \*\*'View grants'\*\* permission.<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/grants/search/mine":{"post":{"description":"Searches grants owned by the current user, not all visible grants.\n\nSupports pagination, scrolling (`scroll` + `scroll_id`), and filtering (`filters`). `page` defaults to `0` and `size` defaults to `20`. Sorting is by relevance unless specified via `sort` parameter.\n\nThe response includes a `x-total-count` header.\n\nSoft‑deleted grants are excluded by default.\n\nRequires **'View grants'** permission.\n","operationId":"TdDdWeb.GrantSearchController.search_my_grants","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantSearchRequest"}}},"description":"Grant search request","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantSearchResponse"}}},"description":"Grant search response"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnprocessableEntityObjectResponse"}}},"description":"Unprocessable Entity"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Search grants for current user","tags":["Grants"]}}},"components":{"schemas":{"GrantSearchRequest":{"additionalProperties":true,"properties":{"filters":{"additionalProperties":true,"type":"object"},"page":{"default":0,"type":"integer"},"query":{"nullable":true,"type":"string"},"scroll":{"nullable":true,"type":"string"},"scroll_id":{"nullable":true,"type":"string"},"size":{"default":20,"type":"integer"},"sort":{"nullable":true,"type":"string"}},"title":"GrantSearchRequest","type":"object"},"GrantSearchResponse":{"additionalProperties":false,"properties":{"data":{"items":{"$ref":"#/components/schemas/Grant"},"type":"array"},"filters":{"additionalProperties":true,"nullable":true,"type":"object"},"scroll_id":{"nullable":true,"type":"string"}},"title":"GrantSearchResponse","type":"object"},"Grant":{"additionalProperties":false,"properties":{"data_structure":{"$ref":"#/components/schemas/GrantDataStructure"},"data_structure_version":{"$ref":"#/components/schemas/GrantDataStructureVersion"},"detail":{"additionalProperties":true,"default":{},"type":"object"},"end_date":{"format":"date","nullable":true,"type":"string"},"external_ref":{"nullable":true,"type":"string"},"id":{"type":"integer"},"inserted_at":{"format":"date-time","type":"string"},"pending_removal":{"default":false,"type":"boolean"},"source_group_name":{"nullable":true,"type":"string"},"source_user_name":{"nullable":true,"type":"string"},"start_date":{"format":"date","nullable":true,"type":"string"},"system":{"additionalProperties":true,"nullable":true,"type":"object"},"updated_at":{"format":"date-time","type":"string"},"user":{"additionalProperties":true,"nullable":true,"type":"object"},"user_group":{"additionalProperties":false,"nullable":true,"properties":{"alias":{"nullable":true,"type":"string"},"id":{"type":"integer"},"name":{"nullable":true,"type":"string"},"users":{"items":{"additionalProperties":false,"properties":{"full_name":{"nullable":true,"type":"string"},"id":{"type":"integer"},"user_name":{"nullable":true,"type":"string"}},"type":"object"},"nullable":true,"type":"array"}},"type":"object"},"user_group_id":{"nullable":true,"type":"integer"},"user_id":{"nullable":true,"type":"integer"}},"required":["id"],"title":"Grant","type":"object"},"GrantDataStructure":{"additionalProperties":false,"properties":{"external_id":{"nullable":true,"type":"string"},"id":{"type":"integer"},"name":{"nullable":true,"type":"string"},"system":{"nullable":true,"properties":{"external_id":{"type":"string"},"id":{"type":"integer"},"name":{"type":"string"}},"type":"object"},"system_id":{"nullable":true,"type":"integer"},"type":{"nullable":true,"type":"string"}},"title":"GrantDataStructure","type":"object"},"GrantDataStructureVersion":{"additionalProperties":true,"properties":{"ancestry":{"items":{"type":"integer"},"nullable":true,"type":"array"},"id":{"nullable":true,"type":"integer"},"name":{"nullable":true,"type":"string"},"path":{"items":{"type":"integer"},"nullable":true,"type":"array"},"version":{"nullable":true,"type":"integer"}},"title":"GrantDataStructureVersion","type":"object"},"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdUnprocessableEntityObjectResponse":{"additionalProperties":false,"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnprocessableEntityObjectResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## Get available grant filters

> Returns the available grant filter values for the caller.\
> \
> Requires \*\*'View grants'\*\* permission.\
> \
> The returned values are permission-aware and based on the payload sent in the request body. Soft‑deleted grants are excluded.<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/grant_filters/search":{"post":{"description":"Returns the available grant filter values for the caller.\n\nRequires **'View grants'** permission.\n\nThe returned values are permission-aware and based on the payload sent in the request body. Soft‑deleted grants are excluded.\n","operationId":"TdDdWeb.GrantFilterController.search","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantSearchRequest"}}},"description":"Grant filter request","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantFilterResponse"}}},"description":"Available filters"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Get available grant filters","tags":["Grants"]}}},"components":{"schemas":{"GrantSearchRequest":{"additionalProperties":true,"properties":{"filters":{"additionalProperties":true,"type":"object"},"page":{"default":0,"type":"integer"},"query":{"nullable":true,"type":"string"},"scroll":{"nullable":true,"type":"string"},"scroll_id":{"nullable":true,"type":"string"},"size":{"default":20,"type":"integer"},"sort":{"nullable":true,"type":"string"}},"title":"GrantSearchRequest","type":"object"},"GrantFilterResponse":{"additionalProperties":false,"properties":{"data":{"additionalProperties":true,"type":"object"}},"title":"GrantFilterResponse","type":"object"},"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## Get grant by ID

> Retrieves a grant by ID and includes only the actions the current user is allowed to perform.\
> \
> Requires the \*\*'View grants'\*\* permission.<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/grants/{id}":{"get":{"description":"Retrieves a grant by ID and includes only the actions the current user is allowed to perform.\n\nRequires the **'View grants'** permission.\n","operationId":"TdDdWeb.GrantController.show","parameters":[{"description":"Grant ID","in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantShowResponse"}}},"description":"Grant retrieved"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdForbiddenResponse"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdNotFoundErrorResponse"}}},"description":"Not found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Get grant by ID","tags":["Grants"]}}},"components":{"schemas":{"GrantShowResponse":{"additionalProperties":false,"properties":{"_actions":{"$ref":"#/components/schemas/GrantActions"},"data":{"$ref":"#/components/schemas/Grant"}},"required":["data"],"title":"GrantShowResponse","type":"object"},"GrantActions":{"additionalProperties":false,"description":"Available actions for grant resource","properties":{"manage_grant_removal":{"additionalProperties":false,"default":{},"type":"object"},"manage_grant_removal_request":{"additionalProperties":false,"default":{},"type":"object"},"update":{"additionalProperties":false,"default":{},"type":"object"}},"title":"GrantActions","type":"object"},"Grant":{"additionalProperties":false,"properties":{"data_structure":{"$ref":"#/components/schemas/GrantDataStructure"},"data_structure_version":{"$ref":"#/components/schemas/GrantDataStructureVersion"},"detail":{"additionalProperties":true,"default":{},"type":"object"},"end_date":{"format":"date","nullable":true,"type":"string"},"external_ref":{"nullable":true,"type":"string"},"id":{"type":"integer"},"inserted_at":{"format":"date-time","type":"string"},"pending_removal":{"default":false,"type":"boolean"},"source_group_name":{"nullable":true,"type":"string"},"source_user_name":{"nullable":true,"type":"string"},"start_date":{"format":"date","nullable":true,"type":"string"},"system":{"additionalProperties":true,"nullable":true,"type":"object"},"updated_at":{"format":"date-time","type":"string"},"user":{"additionalProperties":true,"nullable":true,"type":"object"},"user_group":{"additionalProperties":false,"nullable":true,"properties":{"alias":{"nullable":true,"type":"string"},"id":{"type":"integer"},"name":{"nullable":true,"type":"string"},"users":{"items":{"additionalProperties":false,"properties":{"full_name":{"nullable":true,"type":"string"},"id":{"type":"integer"},"user_name":{"nullable":true,"type":"string"}},"type":"object"},"nullable":true,"type":"array"}},"type":"object"},"user_group_id":{"nullable":true,"type":"integer"},"user_id":{"nullable":true,"type":"integer"}},"required":["id"],"title":"Grant","type":"object"},"GrantDataStructure":{"additionalProperties":false,"properties":{"external_id":{"nullable":true,"type":"string"},"id":{"type":"integer"},"name":{"nullable":true,"type":"string"},"system":{"nullable":true,"properties":{"external_id":{"type":"string"},"id":{"type":"integer"},"name":{"type":"string"}},"type":"object"},"system_id":{"nullable":true,"type":"integer"},"type":{"nullable":true,"type":"string"}},"title":"GrantDataStructure","type":"object"},"GrantDataStructureVersion":{"additionalProperties":true,"properties":{"ancestry":{"items":{"type":"integer"},"nullable":true,"type":"array"},"id":{"nullable":true,"type":"integer"},"name":{"nullable":true,"type":"string"},"path":{"items":{"type":"integer"},"nullable":true,"type":"array"},"version":{"nullable":true,"type":"integer"}},"title":"GrantDataStructureVersion","type":"object"},"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdForbiddenResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdForbiddenResponse","type":"object"},"TdDdNotFoundErrorResponse":{"additionalProperties":false,"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdNotFoundErrorResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## Update grant

> Updates a grant. Two update modes are supported:\
> \
> 1\. \*\*Action‑based updates\*\* (using the \`action\` field):\
> \- \`mark\_pending\_removal\` – marks the grant for future removal (requires \*\*'Remove grant'\*\* permission).\
> \- \`unmark\_pending\_removal\` – clears the pending removal flag (requires \*\*'Remove grant'\*\* permission).\
> \- \`set\_removed\` – immediately ends the grant (requires \*\*'Manage grants'\*\* permission). The grant’s \`end\_date\` is set to the current time and \`pending\_removal\` is cleared.\
> \
> 2\. \*\*Attribute update\*\* (using the \`grant\` object):\
> \- Updates any of: \`user\_id\`, \`start\_date\`, \`end\_date\`, \`source\_user\_name\`, \`detail\`.\
> \- Requires \*\*'Manage grants'\*\* permission.\
> \
> The request must include either \`action\` or \`grant\`, but not both.<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/grants/{id}":{"put":{"description":"Updates a grant. Two update modes are supported:\n\n1. **Action‑based updates** (using the `action` field):\n- `mark_pending_removal` – marks the grant for future removal (requires **'Remove grant'** permission).\n- `unmark_pending_removal` – clears the pending removal flag (requires **'Remove grant'** permission).\n- `set_removed` – immediately ends the grant (requires **'Manage grants'** permission). The grant’s `end_date` is set to the current time and `pending_removal` is cleared.\n\n2. **Attribute update** (using the `grant` object):\n- Updates any of: `user_id`, `start_date`, `end_date`, `source_user_name`, `detail`.\n- Requires **'Manage grants'** permission.\n\nThe request must include either `action` or `grant`, but not both.\n","operationId":"TdDdWeb.GrantController.update","parameters":[{"description":"Grant ID","in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantUpdateRequest"}}},"description":"Grant update payload","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantUpdateResponse"}}},"description":"Grant updated"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdForbiddenResponse"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdNotFoundErrorResponse"}}},"description":"Not found"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnprocessableEntityObjectResponse"}}},"description":"Unprocessable Entity"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Update grant","tags":["Grants"]}}},"components":{"schemas":{"GrantUpdateRequest":{"additionalProperties":false,"properties":{"action":{"description":"Action to perform (optional, when action instead of grant update)","enum":["mark_pending_removal","unmark_pending_removal","set_removed"],"type":"string"},"grant":{"additionalProperties":false,"description":"Grant attributes to update","properties":{"detail":{"additionalProperties":true,"description":"Additional details (optional)","type":"object"},"end_date":{"description":"Grant end date (optional)","format":"date","type":"string"},"source_user_name":{"description":"Source user name (optional)","type":"string"},"start_date":{"description":"Grant start date (optional)","format":"date","type":"string"},"user_id":{"description":"User ID (optional)","type":"integer"}},"type":"object"}},"title":"GrantUpdateRequest","type":"object"},"GrantUpdateResponse":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/Grant"}},"required":["data"],"title":"GrantUpdateResponse","type":"object"},"Grant":{"additionalProperties":false,"properties":{"data_structure":{"$ref":"#/components/schemas/GrantDataStructure"},"data_structure_version":{"$ref":"#/components/schemas/GrantDataStructureVersion"},"detail":{"additionalProperties":true,"default":{},"type":"object"},"end_date":{"format":"date","nullable":true,"type":"string"},"external_ref":{"nullable":true,"type":"string"},"id":{"type":"integer"},"inserted_at":{"format":"date-time","type":"string"},"pending_removal":{"default":false,"type":"boolean"},"source_group_name":{"nullable":true,"type":"string"},"source_user_name":{"nullable":true,"type":"string"},"start_date":{"format":"date","nullable":true,"type":"string"},"system":{"additionalProperties":true,"nullable":true,"type":"object"},"updated_at":{"format":"date-time","type":"string"},"user":{"additionalProperties":true,"nullable":true,"type":"object"},"user_group":{"additionalProperties":false,"nullable":true,"properties":{"alias":{"nullable":true,"type":"string"},"id":{"type":"integer"},"name":{"nullable":true,"type":"string"},"users":{"items":{"additionalProperties":false,"properties":{"full_name":{"nullable":true,"type":"string"},"id":{"type":"integer"},"user_name":{"nullable":true,"type":"string"}},"type":"object"},"nullable":true,"type":"array"}},"type":"object"},"user_group_id":{"nullable":true,"type":"integer"},"user_id":{"nullable":true,"type":"integer"}},"required":["id"],"title":"Grant","type":"object"},"GrantDataStructure":{"additionalProperties":false,"properties":{"external_id":{"nullable":true,"type":"string"},"id":{"type":"integer"},"name":{"nullable":true,"type":"string"},"system":{"nullable":true,"properties":{"external_id":{"type":"string"},"id":{"type":"integer"},"name":{"type":"string"}},"type":"object"},"system_id":{"nullable":true,"type":"integer"},"type":{"nullable":true,"type":"string"}},"title":"GrantDataStructure","type":"object"},"GrantDataStructureVersion":{"additionalProperties":true,"properties":{"ancestry":{"items":{"type":"integer"},"nullable":true,"type":"array"},"id":{"nullable":true,"type":"integer"},"name":{"nullable":true,"type":"string"},"path":{"items":{"type":"integer"},"nullable":true,"type":"array"},"version":{"nullable":true,"type":"integer"}},"title":"GrantDataStructureVersion","type":"object"},"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdForbiddenResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdForbiddenResponse","type":"object"},"TdDdNotFoundErrorResponse":{"additionalProperties":false,"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdNotFoundErrorResponse","type":"object"},"TdDdUnprocessableEntityObjectResponse":{"additionalProperties":false,"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnprocessableEntityObjectResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## Delete grant

> Performs a soft‑delete on the grant identified by the given ID (sets \`deleted\_at\` to the current timestamp) .\
> \
> Requires the \*\*'Manage grants'\*\* permission.<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/grants/{id}":{"delete":{"description":"Performs a soft‑delete on the grant identified by the given ID (sets `deleted_at` to the current timestamp) .\n\nRequires the **'Manage grants'** permission.\n","operationId":"TdDdWeb.GrantController.delete","parameters":[{"description":"Grant ID","in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"204":{"description":"Grant deleted"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdForbiddenResponse"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdNotFoundErrorResponse"}}},"description":"Not found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Delete grant","tags":["Grants"]}}},"components":{"schemas":{"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdForbiddenResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdForbiddenResponse","type":"object"},"TdDdNotFoundErrorResponse":{"additionalProperties":false,"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdNotFoundErrorResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## Update grant

> Updates a grant. Two update modes are supported:\
> \
> 1\. \*\*Action‑based updates\*\* (using the \`action\` field):\
> \- \`mark\_pending\_removal\` – marks the grant for future removal (requires \*\*'Remove grant'\*\* permission).\
> \- \`unmark\_pending\_removal\` – clears the pending removal flag (requires \*\*'Remove grant'\*\* permission).\
> \- \`set\_removed\` – immediately ends the grant (requires \*\*'Manage grants'\*\* permission). The grant’s \`end\_date\` is set to the current time and \`pending\_removal\` is cleared.\
> \
> 2\. \*\*Attribute update\*\* (using the \`grant\` object):\
> \- Updates any of: \`user\_id\`, \`start\_date\`, \`end\_date\`, \`source\_user\_name\`, \`detail\`.\
> \- Requires \*\*'Manage grants'\*\* permission.\
> \
> The request must include either \`action\` or \`grant\`, but not both.<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/grants/{id}":{"patch":{"description":"Updates a grant. Two update modes are supported:\n\n1. **Action‑based updates** (using the `action` field):\n- `mark_pending_removal` – marks the grant for future removal (requires **'Remove grant'** permission).\n- `unmark_pending_removal` – clears the pending removal flag (requires **'Remove grant'** permission).\n- `set_removed` – immediately ends the grant (requires **'Manage grants'** permission). The grant’s `end_date` is set to the current time and `pending_removal` is cleared.\n\n2. **Attribute update** (using the `grant` object):\n- Updates any of: `user_id`, `start_date`, `end_date`, `source_user_name`, `detail`.\n- Requires **'Manage grants'** permission.\n\nThe request must include either `action` or `grant`, but not both.\n","operationId":"TdDdWeb.GrantController.update (2)","parameters":[{"description":"Grant ID","in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantUpdateRequest"}}},"description":"Grant update payload","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantUpdateResponse"}}},"description":"Grant updated"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdForbiddenResponse"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdNotFoundErrorResponse"}}},"description":"Not found"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnprocessableEntityObjectResponse"}}},"description":"Unprocessable Entity"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Update grant","tags":["Grants"]}}},"components":{"schemas":{"GrantUpdateRequest":{"additionalProperties":false,"properties":{"action":{"description":"Action to perform (optional, when action instead of grant update)","enum":["mark_pending_removal","unmark_pending_removal","set_removed"],"type":"string"},"grant":{"additionalProperties":false,"description":"Grant attributes to update","properties":{"detail":{"additionalProperties":true,"description":"Additional details (optional)","type":"object"},"end_date":{"description":"Grant end date (optional)","format":"date","type":"string"},"source_user_name":{"description":"Source user name (optional)","type":"string"},"start_date":{"description":"Grant start date (optional)","format":"date","type":"string"},"user_id":{"description":"User ID (optional)","type":"integer"}},"type":"object"}},"title":"GrantUpdateRequest","type":"object"},"GrantUpdateResponse":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/Grant"}},"required":["data"],"title":"GrantUpdateResponse","type":"object"},"Grant":{"additionalProperties":false,"properties":{"data_structure":{"$ref":"#/components/schemas/GrantDataStructure"},"data_structure_version":{"$ref":"#/components/schemas/GrantDataStructureVersion"},"detail":{"additionalProperties":true,"default":{},"type":"object"},"end_date":{"format":"date","nullable":true,"type":"string"},"external_ref":{"nullable":true,"type":"string"},"id":{"type":"integer"},"inserted_at":{"format":"date-time","type":"string"},"pending_removal":{"default":false,"type":"boolean"},"source_group_name":{"nullable":true,"type":"string"},"source_user_name":{"nullable":true,"type":"string"},"start_date":{"format":"date","nullable":true,"type":"string"},"system":{"additionalProperties":true,"nullable":true,"type":"object"},"updated_at":{"format":"date-time","type":"string"},"user":{"additionalProperties":true,"nullable":true,"type":"object"},"user_group":{"additionalProperties":false,"nullable":true,"properties":{"alias":{"nullable":true,"type":"string"},"id":{"type":"integer"},"name":{"nullable":true,"type":"string"},"users":{"items":{"additionalProperties":false,"properties":{"full_name":{"nullable":true,"type":"string"},"id":{"type":"integer"},"user_name":{"nullable":true,"type":"string"}},"type":"object"},"nullable":true,"type":"array"}},"type":"object"},"user_group_id":{"nullable":true,"type":"integer"},"user_id":{"nullable":true,"type":"integer"}},"required":["id"],"title":"Grant","type":"object"},"GrantDataStructure":{"additionalProperties":false,"properties":{"external_id":{"nullable":true,"type":"string"},"id":{"type":"integer"},"name":{"nullable":true,"type":"string"},"system":{"nullable":true,"properties":{"external_id":{"type":"string"},"id":{"type":"integer"},"name":{"type":"string"}},"type":"object"},"system_id":{"nullable":true,"type":"integer"},"type":{"nullable":true,"type":"string"}},"title":"GrantDataStructure","type":"object"},"GrantDataStructureVersion":{"additionalProperties":true,"properties":{"ancestry":{"items":{"type":"integer"},"nullable":true,"type":"array"},"id":{"nullable":true,"type":"integer"},"name":{"nullable":true,"type":"string"},"path":{"items":{"type":"integer"},"nullable":true,"type":"array"},"version":{"nullable":true,"type":"integer"}},"title":"GrantDataStructureVersion","type":"object"},"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdForbiddenResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdForbiddenResponse","type":"object"},"TdDdNotFoundErrorResponse":{"additionalProperties":false,"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdNotFoundErrorResponse","type":"object"},"TdDdUnprocessableEntityObjectResponse":{"additionalProperties":false,"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnprocessableEntityObjectResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## Reindex all grants

> Schedules a full reindex of grants and returns \`202\` when the job is enqueued.\
> \
> Requires administrative privileges (\*\*administrator or service account\*\*).<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/grants/search/reindex_all":{"get":{"description":"Schedules a full reindex of grants and returns `202` when the job is enqueued.\n\nRequires administrative privileges (**administrator or service account**).\n","operationId":"TdDdWeb.GrantSearchController.reindex_all_grants","parameters":[],"responses":{"202":{"description":"Reindexing accepted"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdForbiddenResponse"}}},"description":"Forbidden"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Reindex all grants","tags":["Grants"]}}},"components":{"schemas":{"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdForbiddenResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdForbiddenResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## Get available grant filters for current user

> Returns available filter values for grants assigned to the current user, based on the provided search criteria.\
> \
> Requires \*\*'View grants'\*\* permission.\
> \
> The result is permission-aware and based on the payload sent in the request body. Soft‑deleted grants are excluded.<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/grant_filters/search/mine":{"post":{"description":"Returns available filter values for grants assigned to the current user, based on the provided search criteria.\n\nRequires **'View grants'** permission.\n\nThe result is permission-aware and based on the payload sent in the request body. Soft‑deleted grants are excluded.\n","operationId":"TdDdWeb.GrantFilterController.search_mine","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantSearchRequest"}}},"description":"Grant filter request","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantFilterResponse"}}},"description":"Available filters"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Get available grant filters for current user","tags":["Grants"]}}},"components":{"schemas":{"GrantSearchRequest":{"additionalProperties":true,"properties":{"filters":{"additionalProperties":true,"type":"object"},"page":{"default":0,"type":"integer"},"query":{"nullable":true,"type":"string"},"scroll":{"nullable":true,"type":"string"},"scroll_id":{"nullable":true,"type":"string"},"size":{"default":20,"type":"integer"},"sort":{"nullable":true,"type":"string"}},"title":"GrantSearchRequest","type":"object"},"GrantFilterResponse":{"additionalProperties":false,"properties":{"data":{"additionalProperties":true,"type":"object"}},"title":"GrantFilterResponse","type":"object"},"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## List all active grants

> Lists active grants visible to the current user. The list does not include soft-deleted grants.\
> \
> Requires the \*\*'View grants'\*\* permission.<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/grants":{"get":{"description":"Lists active grants visible to the current user. The list does not include soft-deleted grants.\n\nRequires the **'View grants'** permission.\n","operationId":"TdDdWeb.GrantController.index","parameters":[],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantListResponse"}}},"description":"List of grants"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdForbiddenResponse"}}},"description":"Forbidden"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnprocessableEntityObjectResponse"}}},"description":"Unprocessable Entity"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"List all active grants","tags":["Grants"]}}},"components":{"schemas":{"GrantListResponse":{"additionalProperties":false,"properties":{"data":{"items":{"$ref":"#/components/schemas/Grant"},"type":"array"}},"required":["data"],"title":"GrantListResponse","type":"object"},"Grant":{"additionalProperties":false,"properties":{"data_structure":{"$ref":"#/components/schemas/GrantDataStructure"},"data_structure_version":{"$ref":"#/components/schemas/GrantDataStructureVersion"},"detail":{"additionalProperties":true,"default":{},"type":"object"},"end_date":{"format":"date","nullable":true,"type":"string"},"external_ref":{"nullable":true,"type":"string"},"id":{"type":"integer"},"inserted_at":{"format":"date-time","type":"string"},"pending_removal":{"default":false,"type":"boolean"},"source_group_name":{"nullable":true,"type":"string"},"source_user_name":{"nullable":true,"type":"string"},"start_date":{"format":"date","nullable":true,"type":"string"},"system":{"additionalProperties":true,"nullable":true,"type":"object"},"updated_at":{"format":"date-time","type":"string"},"user":{"additionalProperties":true,"nullable":true,"type":"object"},"user_group":{"additionalProperties":false,"nullable":true,"properties":{"alias":{"nullable":true,"type":"string"},"id":{"type":"integer"},"name":{"nullable":true,"type":"string"},"users":{"items":{"additionalProperties":false,"properties":{"full_name":{"nullable":true,"type":"string"},"id":{"type":"integer"},"user_name":{"nullable":true,"type":"string"}},"type":"object"},"nullable":true,"type":"array"}},"type":"object"},"user_group_id":{"nullable":true,"type":"integer"},"user_id":{"nullable":true,"type":"integer"}},"required":["id"],"title":"Grant","type":"object"},"GrantDataStructure":{"additionalProperties":false,"properties":{"external_id":{"nullable":true,"type":"string"},"id":{"type":"integer"},"name":{"nullable":true,"type":"string"},"system":{"nullable":true,"properties":{"external_id":{"type":"string"},"id":{"type":"integer"},"name":{"type":"string"}},"type":"object"},"system_id":{"nullable":true,"type":"integer"},"type":{"nullable":true,"type":"string"}},"title":"GrantDataStructure","type":"object"},"GrantDataStructureVersion":{"additionalProperties":true,"properties":{"ancestry":{"items":{"type":"integer"},"nullable":true,"type":"array"},"id":{"nullable":true,"type":"integer"},"name":{"nullable":true,"type":"string"},"path":{"items":{"type":"integer"},"nullable":true,"type":"array"},"version":{"nullable":true,"type":"integer"}},"title":"GrantDataStructureVersion","type":"object"},"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdForbiddenResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdForbiddenResponse","type":"object"},"TdDdUnprocessableEntityObjectResponse":{"additionalProperties":false,"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnprocessableEntityObjectResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## Bulk create, update and delete grants

> Accepts a bulk grants payload and processes each operation independently.\
> \
> Supported operations: \`add\`, \`update\`and \`remove\`.\
> \
> Operations are processed independently. A failure in one item does not affect others. The endpoint always returns HTTP \`200\` even if some items fail. Reports per-item failures in the \`errors\` array instead of rejecting the whole request.\
> The response includes:\
> \- \`ids\` – all processed grant IDs (created, updated, removed).\
> \- \`created\_ids\`, \`updated\_ids\`, \`removed\_ids\` – separate lists for each operation.\
> \- \`errors\` – an array of objects describing each failed operation, including the \`op\`, the affected \`id\` (if applicable), and a \`message\`.\
> Requires \`Manage grants\` permission.\
> \
> \*\*Request parameters:\*\*\
> Each item in the \`grants\` array must include:\
> \- \`op\` – one of \`'add'\`, \`'update'\`, \`'remove'\`.\
> \- For \`add\`: \`user\_id\` (required), \`data\_structure\_external\_id\` (required), optional \`start\_date\`, \`end\_date\`, \`source\_user\_name\`, \`detail\`.\
> \- For \`update\`: \`id\` (required) and any fields to modify (\`start\_date\`, \`end\_date\`, \`source\_user\_name\`, \`detail\`).\
> \- For \`remove\`: \`id\` (required).<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/grants_bulk":{"put":{"description":"Accepts a bulk grants payload and processes each operation independently.\n\nSupported operations: `add`, `update`and `remove`.\n\nOperations are processed independently. A failure in one item does not affect others. The endpoint always returns HTTP `200` even if some items fail. Reports per-item failures in the `errors` array instead of rejecting the whole request.\nThe response includes:\n- `ids` – all processed grant IDs (created, updated, removed).\n- `created_ids`, `updated_ids`, `removed_ids` – separate lists for each operation.\n- `errors` – an array of objects describing each failed operation, including the `op`, the affected `id` (if applicable), and a `message`.\nRequires `Manage grants` permission.\n\n**Request parameters:**\nEach item in the `grants` array must include:\n- `op` – one of `'add'`, `'update'`, `'remove'`.\n- For `add`: `user_id` (required), `data_structure_external_id` (required), optional `start_date`, `end_date`, `source_user_name`, `detail`.\n- For `update`: `id` (required) and any fields to modify (`start_date`, `end_date`, `source_user_name`, `detail`).\n- For `remove`: `id` (required).\n","operationId":"TdDdWeb.GrantsController.update","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantsBulkUpdateRequest"}}},"description":"Grants bulk update payload","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantsBulkUpdateResponse"}}},"description":"Grants processed"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Bulk create, update and delete grants","tags":["Grants"]}}},"components":{"schemas":{"GrantsBulkUpdateRequest":{"additionalProperties":false,"properties":{"grants":{"items":{"additionalProperties":false,"description":"Bulk grant operation. For 'add', provide either user fields or group fields (XOR).","properties":{"data_structure_external_id":{"description":"External ID of the data structure (for 'add' operation)","type":"string"},"detail":{"additionalProperties":true,"default":{},"description":"Additional details","type":"object"},"end_date":{"description":"End date YYYY-MM-DD (for 'add' and 'update' operations)","format":"date","type":"string"},"id":{"description":"Grant ID (required for 'update' and 'remove' operations)","type":"integer"},"op":{"description":"Operation type: 'add', 'update', 'remove'","enum":["add","update","remove"],"type":"string"},"source_group_name":{"description":"External source group name (for 'add' operation)","type":"string"},"source_user_name":{"description":"Source user name (for 'add' operation)","type":"string"},"start_date":{"description":"Start date YYYY-MM-DD (for 'add' and 'update' operations)","format":"date","type":"string"},"user_group_alias":{"description":"User group alias (resolved to user_group_id, for 'add' operation)","type":"string"},"user_group_id":{"description":"User group ID (for 'add' operation)","nullable":true,"type":"integer"},"user_group_name":{"description":"User group name (resolved to user_group_id, for 'add' operation)","type":"string"},"user_id":{"description":"User ID (for 'add' operation)","type":"integer"}},"type":"object"},"type":"array"}},"required":["grants"],"title":"GrantsBulkUpdateRequest","type":"object"},"GrantsBulkUpdateResponse":{"additionalProperties":false,"properties":{"created_ids":{"description":"IDs of grants created by 'add' operations","items":{"type":"integer"},"type":"array"},"errors":{"description":"List of errors for failed operations","items":{"additionalProperties":true,"description":"Error details","type":"object"},"type":"array"},"ids":{"description":"IDs of all successfully processed grants (created, updated and removed combined)","items":{"type":"integer"},"type":"array"},"removed_ids":{"description":"IDs of grants deleted by 'remove' operations","items":{"type":"integer"},"type":"array"},"updated_ids":{"description":"IDs of grants modified by 'update' operations","items":{"type":"integer"},"type":"array"}},"required":["ids","created_ids","updated_ids","removed_ids","errors"],"title":"GrantsBulkUpdateResponse","type":"object"},"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## Bulk create, update and delete grants

> Accepts a bulk grants payload and processes each operation independently.\
> \
> Supported operations: \`add\`, \`update\`and \`remove\`.\
> \
> Operations are processed independently. A failure in one item does not affect others. The endpoint always returns HTTP \`200\` even if some items fail. Reports per-item failures in the \`errors\` array instead of rejecting the whole request.\
> The response includes:\
> \- \`ids\` – all processed grant IDs (created, updated, removed).\
> \- \`created\_ids\`, \`updated\_ids\`, \`removed\_ids\` – separate lists for each operation.\
> \- \`errors\` – an array of objects describing each failed operation, including the \`op\`, the affected \`id\` (if applicable), and a \`message\`.\
> Requires \`Manage grants\` permission.\
> \
> \*\*Request parameters:\*\*\
> Each item in the \`grants\` array must include:\
> \- \`op\` – one of \`'add'\`, \`'update'\`, \`'remove'\`.\
> \- For \`add\`: \`user\_id\` (required), \`data\_structure\_external\_id\` (required), optional \`start\_date\`, \`end\_date\`, \`source\_user\_name\`, \`detail\`.\
> \- For \`update\`: \`id\` (required) and any fields to modify (\`start\_date\`, \`end\_date\`, \`source\_user\_name\`, \`detail\`).\
> \- For \`remove\`: \`id\` (required).<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/grants_bulk":{"patch":{"description":"Accepts a bulk grants payload and processes each operation independently.\n\nSupported operations: `add`, `update`and `remove`.\n\nOperations are processed independently. A failure in one item does not affect others. The endpoint always returns HTTP `200` even if some items fail. Reports per-item failures in the `errors` array instead of rejecting the whole request.\nThe response includes:\n- `ids` – all processed grant IDs (created, updated, removed).\n- `created_ids`, `updated_ids`, `removed_ids` – separate lists for each operation.\n- `errors` – an array of objects describing each failed operation, including the `op`, the affected `id` (if applicable), and a `message`.\nRequires `Manage grants` permission.\n\n**Request parameters:**\nEach item in the `grants` array must include:\n- `op` – one of `'add'`, `'update'`, `'remove'`.\n- For `add`: `user_id` (required), `data_structure_external_id` (required), optional `start_date`, `end_date`, `source_user_name`, `detail`.\n- For `update`: `id` (required) and any fields to modify (`start_date`, `end_date`, `source_user_name`, `detail`).\n- For `remove`: `id` (required).\n","operationId":"TdDdWeb.GrantsController.update (2)","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantsBulkUpdateRequest"}}},"description":"Grants bulk update payload","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantsBulkUpdateResponse"}}},"description":"Grants processed"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Bulk create, update and delete grants","tags":["Grants"]}}},"components":{"schemas":{"GrantsBulkUpdateRequest":{"additionalProperties":false,"properties":{"grants":{"items":{"additionalProperties":false,"description":"Bulk grant operation. For 'add', provide either user fields or group fields (XOR).","properties":{"data_structure_external_id":{"description":"External ID of the data structure (for 'add' operation)","type":"string"},"detail":{"additionalProperties":true,"default":{},"description":"Additional details","type":"object"},"end_date":{"description":"End date YYYY-MM-DD (for 'add' and 'update' operations)","format":"date","type":"string"},"id":{"description":"Grant ID (required for 'update' and 'remove' operations)","type":"integer"},"op":{"description":"Operation type: 'add', 'update', 'remove'","enum":["add","update","remove"],"type":"string"},"source_group_name":{"description":"External source group name (for 'add' operation)","type":"string"},"source_user_name":{"description":"Source user name (for 'add' operation)","type":"string"},"start_date":{"description":"Start date YYYY-MM-DD (for 'add' and 'update' operations)","format":"date","type":"string"},"user_group_alias":{"description":"User group alias (resolved to user_group_id, for 'add' operation)","type":"string"},"user_group_id":{"description":"User group ID (for 'add' operation)","nullable":true,"type":"integer"},"user_group_name":{"description":"User group name (resolved to user_group_id, for 'add' operation)","type":"string"},"user_id":{"description":"User ID (for 'add' operation)","type":"integer"}},"type":"object"},"type":"array"}},"required":["grants"],"title":"GrantsBulkUpdateRequest","type":"object"},"GrantsBulkUpdateResponse":{"additionalProperties":false,"properties":{"created_ids":{"description":"IDs of grants created by 'add' operations","items":{"type":"integer"},"type":"array"},"errors":{"description":"List of errors for failed operations","items":{"additionalProperties":true,"description":"Error details","type":"object"},"type":"array"},"ids":{"description":"IDs of all successfully processed grants (created, updated and removed combined)","items":{"type":"integer"},"type":"array"},"removed_ids":{"description":"IDs of grants deleted by 'remove' operations","items":{"type":"integer"},"type":"array"},"updated_ids":{"description":"IDs of grants modified by 'update' operations","items":{"type":"integer"},"type":"array"}},"required":["ids","created_ids","updated_ids","removed_ids","errors"],"title":"GrantsBulkUpdateResponse","type":"object"},"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## Search grants by permissions

> Searches grants using the supplied criteria while filtering them by the current user's permissions.\
> \
> Supports pagination, scrolling (\`scroll\` + \`scroll\_id\`), and filtering (\`filters\`). \`page\` defaults to \`0\` and \`size\` defaults to \`20\`. Sorting is by relevance unless specified via \`sort\` parameter.\
> \
> The response includes a \`x-total-count\` header.\
> \
> Soft‑deleted grants are excluded by default.\
> \
> Requires \*\*'View grants'\*\* permission.<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/grants/search":{"post":{"description":"Searches grants using the supplied criteria while filtering them by the current user's permissions.\n\nSupports pagination, scrolling (`scroll` + `scroll_id`), and filtering (`filters`). `page` defaults to `0` and `size` defaults to `20`. Sorting is by relevance unless specified via `sort` parameter.\n\nThe response includes a `x-total-count` header.\n\nSoft‑deleted grants are excluded by default.\n\nRequires **'View grants'** permission.\n","operationId":"TdDdWeb.GrantSearchController.search_grants","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantSearchRequest"}}},"description":"Grant search request","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantSearchResponse"}}},"description":"Grant search response"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnprocessableEntityObjectResponse"}}},"description":"Unprocessable Entity"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Search grants by permissions","tags":["Grants"]}}},"components":{"schemas":{"GrantSearchRequest":{"additionalProperties":true,"properties":{"filters":{"additionalProperties":true,"type":"object"},"page":{"default":0,"type":"integer"},"query":{"nullable":true,"type":"string"},"scroll":{"nullable":true,"type":"string"},"scroll_id":{"nullable":true,"type":"string"},"size":{"default":20,"type":"integer"},"sort":{"nullable":true,"type":"string"}},"title":"GrantSearchRequest","type":"object"},"GrantSearchResponse":{"additionalProperties":false,"properties":{"data":{"items":{"$ref":"#/components/schemas/Grant"},"type":"array"},"filters":{"additionalProperties":true,"nullable":true,"type":"object"},"scroll_id":{"nullable":true,"type":"string"}},"title":"GrantSearchResponse","type":"object"},"Grant":{"additionalProperties":false,"properties":{"data_structure":{"$ref":"#/components/schemas/GrantDataStructure"},"data_structure_version":{"$ref":"#/components/schemas/GrantDataStructureVersion"},"detail":{"additionalProperties":true,"default":{},"type":"object"},"end_date":{"format":"date","nullable":true,"type":"string"},"external_ref":{"nullable":true,"type":"string"},"id":{"type":"integer"},"inserted_at":{"format":"date-time","type":"string"},"pending_removal":{"default":false,"type":"boolean"},"source_group_name":{"nullable":true,"type":"string"},"source_user_name":{"nullable":true,"type":"string"},"start_date":{"format":"date","nullable":true,"type":"string"},"system":{"additionalProperties":true,"nullable":true,"type":"object"},"updated_at":{"format":"date-time","type":"string"},"user":{"additionalProperties":true,"nullable":true,"type":"object"},"user_group":{"additionalProperties":false,"nullable":true,"properties":{"alias":{"nullable":true,"type":"string"},"id":{"type":"integer"},"name":{"nullable":true,"type":"string"},"users":{"items":{"additionalProperties":false,"properties":{"full_name":{"nullable":true,"type":"string"},"id":{"type":"integer"},"user_name":{"nullable":true,"type":"string"}},"type":"object"},"nullable":true,"type":"array"}},"type":"object"},"user_group_id":{"nullable":true,"type":"integer"},"user_id":{"nullable":true,"type":"integer"}},"required":["id"],"title":"Grant","type":"object"},"GrantDataStructure":{"additionalProperties":false,"properties":{"external_id":{"nullable":true,"type":"string"},"id":{"type":"integer"},"name":{"nullable":true,"type":"string"},"system":{"nullable":true,"properties":{"external_id":{"type":"string"},"id":{"type":"integer"},"name":{"type":"string"}},"type":"object"},"system_id":{"nullable":true,"type":"integer"},"type":{"nullable":true,"type":"string"}},"title":"GrantDataStructure","type":"object"},"GrantDataStructureVersion":{"additionalProperties":true,"properties":{"ancestry":{"items":{"type":"integer"},"nullable":true,"type":"array"},"id":{"nullable":true,"type":"integer"},"name":{"nullable":true,"type":"string"},"path":{"items":{"type":"integer"},"nullable":true,"type":"array"},"version":{"nullable":true,"type":"integer"}},"title":"GrantDataStructureVersion","type":"object"},"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdUnprocessableEntityObjectResponse":{"additionalProperties":false,"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnprocessableEntityObjectResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## Download grants as XLSX

> Generates an XLSX file containing grant data matching the request filters.\
> \
> \*\*Request parameters:\*\*\
> \- \`search\_by\` (required) – either \`'permissions'\` (use the caller's permission‑based view) or \`'user'\` (grants where the caller is the grantee).\
> \- \`header\_labels\` (required) – a map of original field names to custom column labels in the exported file.\
> \- Optional: \`filters\` (the export ignores pagination and returns all matching records up to 10 000).\
> \
> Requires the \*\*'View grants'\*\* permission. The export includes the matching grant records visible to the caller.<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/grants/xlsx/download":{"post":{"description":"Generates an XLSX file containing grant data matching the request filters.\n\n**Request parameters:**\n- `search_by` (required) – either `'permissions'` (use the caller's permission‑based view) or `'user'` (grants where the caller is the grantee).\n- `header_labels` (required) – a map of original field names to custom column labels in the exported file.\n- Optional: `filters` (the export ignores pagination and returns all matching records up to 10 000).\n\nRequires the **'View grants'** permission. The export includes the matching grant records visible to the caller.\n","operationId":"TdDdWeb.GrantController.download","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantsDownloadRequest"}}},"description":"Grant download request","required":false},"responses":{"200":{"content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"format":"binary","type":"string"}}},"description":"XLSX file downloaded"},"204":{"description":"No grants available for download"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnprocessableEntityObjectResponse"}}},"description":"Unprocessable Entity"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Download grants as XLSX","tags":["Grants"]}}},"components":{"schemas":{"GrantsDownloadRequest":{"additionalProperties":false,"properties":{"filters":{"additionalProperties":true,"type":"object"},"header_labels":{"additionalProperties":{"type":"string"},"type":"object"},"lang":{"description":"Locale used to translate deleted user/group labels. Defaults to the default locale.","nullable":true,"type":"string"},"page":{"type":"integer"},"search_by":{"enum":["permissions","user"],"type":"string"},"size":{"type":"integer"}},"required":["search_by","header_labels"],"title":"GrantsDownloadRequest","type":"object"},"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdUnprocessableEntityObjectResponse":{"additionalProperties":false,"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnprocessableEntityObjectResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```
