> 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.8/api-integrations/data-catalog-data-lineage-and-grants-apis/grants.md).

# Grants

## Create grant

> Creates a new grant for the specified data structure.

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.8.2"},"paths":{"/api/data_structures/{data_structure_id}/grants":{"post":{"description":"Creates a new grant for the specified data structure.","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","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 (required)","type":"integer"}},"required":["user_id"],"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_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_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 or visible to the current user.

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.8.2"},"paths":{"/api/grants/search/mine":{"post":{"description":"Searches grants owned by or visible to the current user.","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_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_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 available grant filters for the caller based on permissions and provided search criteria.

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.8.2"},"paths":{"/api/grant_filters/search":{"post":{"description":"Returns available grant filters for the caller based on permissions and provided search criteria.","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 the grant with the given ID, including allowed actions for the current user.

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.8.2"},"paths":{"/api/grants/{id}":{"get":{"description":"Retrieves the grant with the given ID, including allowed actions for the current user.","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_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_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 the specified grant using the provided action or grant payload.

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.8.2"},"paths":{"/api/grants/{id}":{"put":{"description":"Updates the specified grant using the provided action or grant payload.","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_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_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

> Deletes the grant identified by the given ID.

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.8.2"},"paths":{"/api/grants/{id}":{"delete":{"description":"Deletes the grant identified by the given ID.","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 the specified grant using the provided action or grant payload.

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.8.2"},"paths":{"/api/grants/{id}":{"patch":{"description":"Updates the specified grant using the provided action or grant payload.","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_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_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 Accepted when the job is enqueued.

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.8.2"},"paths":{"/api/grants/search/reindex_all":{"get":{"description":"Schedules a full reindex of grants and returns 202 Accepted when the job is enqueued.","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 grant filters for grants associated with the current user, based on their permissions and provided search criteria.

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.8.2"},"paths":{"/api/grant_filters/search/mine":{"post":{"description":"Returns available grant filters for grants associated with the current user, based on their permissions and provided search criteria.","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

> Returns all active grants visible to the current user.

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.8.2"},"paths":{"/api/grants":{"get":{"description":"Returns all active grants visible to the current user.","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_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_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 update grants

> Accepts a bulk grants payload and applies updates, returning status of processed grants.

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.8.2"},"paths":{"/api/grants_bulk":{"put":{"description":"Accepts a bulk grants payload and applies updates, returning status of processed grants.","operationId":"TdDdWeb.GrantsController.update","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantsBulkUpdateRequest"}}},"description":"Grants bulk update payload","required":false},"responses":{"200":{"description":"Grants updated"},"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/DDUnprocessableEntityVariableResponse"}}},"description":"Unprocessable Entity"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Bulk update grants","tags":["Grants"]}}},"components":{"schemas":{"GrantsBulkUpdateRequest":{"additionalProperties":false,"properties":{"grants":{"items":{"additionalProperties":false,"properties":{"data_structure_external_id":{"description":"External ID of the data structure","type":"string"},"detail":{"additionalProperties":true,"default":{},"description":"Additional details","type":"object"},"end_date":{"description":"End date (YYYY-MM-DD)","format":"date","type":"string"},"op":{"description":"Operation type (only 'add' supported)","enum":["add"],"type":"string"},"source_user_name":{"description":"Source user name","type":"string"},"start_date":{"description":"Start date (YYYY-MM-DD)","format":"date","type":"string"},"user_id":{"description":"User ID","type":"integer"}},"required":["user_id","data_structure_external_id","start_date","end_date","source_user_name"],"type":"object"},"type":"array"}},"required":["grants"],"title":"GrantsBulkUpdateRequest","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"},"DDUnprocessableEntityVariableResponse":{"description":"Response for 422 errors. Error messages might have different formats","oneOf":[{"$ref":"#/components/schemas/TdDdUnprocessableEntityStringResponse"},{"$ref":"#/components/schemas/TdDdUnprocessableEntityArrayResponse"},{"$ref":"#/components/schemas/TdDdUnprocessableEntityObjectResponse"}],"title":"DDUnprocessableEntityVariableResponse"},"TdDdUnprocessableEntityStringResponse":{"additionalProperties":false,"properties":{"error":{"type":"string"},"message":{"type":"string"}},"title":"TdDdUnprocessableEntityStringResponse","type":"object"},"TdDdUnprocessableEntityArrayResponse":{"additionalProperties":false,"properties":{"error":{"items":{"type":"string"},"type":"array"},"errors":{"items":{"properties":{"code":{"type":"string"},"name":{"type":"string"}},"type":"object"},"type":"array"}},"title":"TdDdUnprocessableEntityArrayResponse","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 update grants

> Accepts a bulk grants payload and applies updates, returning status of processed grants.

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.8.2"},"paths":{"/api/grants_bulk":{"patch":{"description":"Accepts a bulk grants payload and applies updates, returning status of processed grants.","operationId":"TdDdWeb.GrantsController.update (2)","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantsBulkUpdateRequest"}}},"description":"Grants bulk update payload","required":false},"responses":{"200":{"description":"Grants updated"},"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/DDUnprocessableEntityVariableResponse"}}},"description":"Unprocessable Entity"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Bulk update grants","tags":["Grants"]}}},"components":{"schemas":{"GrantsBulkUpdateRequest":{"additionalProperties":false,"properties":{"grants":{"items":{"additionalProperties":false,"properties":{"data_structure_external_id":{"description":"External ID of the data structure","type":"string"},"detail":{"additionalProperties":true,"default":{},"description":"Additional details","type":"object"},"end_date":{"description":"End date (YYYY-MM-DD)","format":"date","type":"string"},"op":{"description":"Operation type (only 'add' supported)","enum":["add"],"type":"string"},"source_user_name":{"description":"Source user name","type":"string"},"start_date":{"description":"Start date (YYYY-MM-DD)","format":"date","type":"string"},"user_id":{"description":"User ID","type":"integer"}},"required":["user_id","data_structure_external_id","start_date","end_date","source_user_name"],"type":"object"},"type":"array"}},"required":["grants"],"title":"GrantsBulkUpdateRequest","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"},"DDUnprocessableEntityVariableResponse":{"description":"Response for 422 errors. Error messages might have different formats","oneOf":[{"$ref":"#/components/schemas/TdDdUnprocessableEntityStringResponse"},{"$ref":"#/components/schemas/TdDdUnprocessableEntityArrayResponse"},{"$ref":"#/components/schemas/TdDdUnprocessableEntityObjectResponse"}],"title":"DDUnprocessableEntityVariableResponse"},"TdDdUnprocessableEntityStringResponse":{"additionalProperties":false,"properties":{"error":{"type":"string"},"message":{"type":"string"}},"title":"TdDdUnprocessableEntityStringResponse","type":"object"},"TdDdUnprocessableEntityArrayResponse":{"additionalProperties":false,"properties":{"error":{"items":{"type":"string"},"type":"array"},"errors":{"items":{"properties":{"code":{"type":"string"},"name":{"type":"string"}},"type":"object"},"type":"array"}},"title":"TdDdUnprocessableEntityArrayResponse","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 by permissions

> Searches grants using the provided criteria and returns results filtered by the current user's permissions.

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.8.2"},"paths":{"/api/grants/search":{"post":{"description":"Searches grants using the provided criteria and returns results filtered by the current user's permissions.","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_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_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.

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.8.2"},"paths":{"/api/grants/xlsx/download":{"post":{"description":"Generates an XLSX file containing grant data matching the request filters.","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"},"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"}}}}
```
