> For the complete documentation index, see [llms.txt](https://academy.shade.inc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://academy.shade.inc/developers/knock.md).

# Knock

## POST /knock/token

> Generate a Knock user token for the current user

```json
{"openapi":"3.1.0","info":{"title":"shade","version":"dev"},"paths":{"/knock/token":{"post":{"tags":["knock"],"summary":"Generate a Knock user token for the current user","operationId":"generate_knock_user_token_knock_token_post","parameters":[{"name":"workspace_id","in":"query","required":false,"schema":{"type":"string","format":"uuid","title":"The workspace id","description":"The id of the workspace"},"description":"The id of the workspace"},{"name":"drive_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"The drive id (optional)","description":"The id of the drive. If provided, generates a token scoped to workspace + this drive only. If omitted, generates a token for workspace + all drives (legacy, avoid with 50+ drives)."},"description":"The id of the drive. If provided, generates a token scoped to workspace + this drive only. If omitted, generates a token for workspace + all drives (legacy, avoid with 50+ drives)."},{"name":"password","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"The password","description":"The password header to use to fetch the preview"},"description":"The password header to use to fetch the preview"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_generate_knock_user_token_knock_token_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnockTokenResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Body_generate_knock_user_token_knock_token_post":{"properties":{"body":{"additionalProperties":true,"type":"object","title":"Body","default":{}}},"type":"object","title":"Body_generate_knock_user_token_knock_token_post"},"KnockTokenResponse":{"properties":{"token":{"type":"string","title":"Token"},"expires_at":{"type":"integer","title":"Expires At"}},"type":"object","required":["token","expires_at"],"title":"KnockTokenResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}
```

## GET /knock/drives/{drive\_id}/preferences

> Fetch Knock notification preferences for a drive

```json
{"openapi":"3.1.0","info":{"title":"shade","version":"dev"},"paths":{"/knock/drives/{drive_id}/preferences":{"get":{"tags":["knock"],"summary":"Fetch Knock notification preferences for a drive","operationId":"get_drive_notification_preferences_knock_drives__drive_id__preferences_get","parameters":[{"name":"drive_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"The drive id"}},{"name":"password","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"The password","description":"The password header to use to fetch the preview"},"description":"The password header to use to fetch the preview"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_get_drive_notification_preferences_knock_drives__drive_id__preferences_get"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Drive Notification Preferences Knock Drives  Drive Id  Preferences Get"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Body_get_drive_notification_preferences_knock_drives__drive_id__preferences_get":{"properties":{"body":{"additionalProperties":true,"type":"object","title":"Body","default":{}}},"type":"object","title":"Body_get_drive_notification_preferences_knock_drives__drive_id__preferences_get"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}
```

## PUT /knock/drives/{drive\_id}/preferences

> Update Knock notification preferences for a drive

```json
{"openapi":"3.1.0","info":{"title":"shade","version":"dev"},"paths":{"/knock/drives/{drive_id}/preferences":{"put":{"tags":["knock"],"summary":"Update Knock notification preferences for a drive","operationId":"update_drive_notification_preferences_knock_drives__drive_id__preferences_put","parameters":[{"name":"drive_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"The drive id"}},{"name":"password","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"The password","description":"The password header to use to fetch the preview"},"description":"The password header to use to fetch the preview"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_update_drive_notification_preferences_knock_drives__drive_id__preferences_put"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Drive Notification Preferences Knock Drives  Drive Id  Preferences Put"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Body_update_drive_notification_preferences_knock_drives__drive_id__preferences_put":{"properties":{"preferences":{"$ref":"#/components/schemas/KnockPreferenceSetPayload","title":"The preference set"},"body":{"additionalProperties":true,"type":"object","title":"Body","default":{}}},"type":"object","required":["preferences"],"title":"Body_update_drive_notification_preferences_knock_drives__drive_id__preferences_put"},"KnockPreferenceSetPayload":{"properties":{"id":{"type":"string","title":"Id","default":"default"},"workflows":{"additionalProperties":true,"type":"object","title":"Workflows"}},"type":"object","required":["workflows"],"title":"KnockPreferenceSetPayload"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://academy.shade.inc/developers/knock.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
