Skip to Content
APIEndpointsGet knowledge document file

Get knowledge document file

A short-lived (60 second) signed download URL for the original PDF behind a document created from a PDF upload. Not available for pasted-text documents.

Requires the read:knowledge_base scope.

GET /brands/{brand_id}/knowledge-documents/{document_id}/file

Authorization

HeaderTypeRequired
AuthorizationBearer asky_sk_…required

Path parameters

ParameterTypeRequiredDescription
brand_iduuidrequiredFrom List brands
document_iduuidrequiredFrom List knowledge documents

Request

curl --request GET \ --url 'https://api.askylabs.com/v1/brands/242546de-4cee-4a7d-952e-f6aa60c63ef8/knowledge-documents/d29a6f31-1c4e-4b8a-9d2f-7a0c3e5b8f61/file' \ --header 'Authorization: Bearer <api-key>'

Response

{ "data": { "url": "https://xyzcompany.supabase.co/storage/v1/object/sign/knowledge-base-files/242546de.../d29a6f31....pdf?token=...", "expires_in_seconds": 60 }, "request_id": "req_9f2b8a3c1e7d4f6a8b0c" }

Response fields

FieldTypeDescription
data.urlstringrequired. Signed download URL, valid for expires_in_seconds
data.expires_in_secondsintegerrequired. Always 60
request_idstringrequired. Also returned as the x-request-id header. Quote it when contacting support

Errors

StatusCodeWhen
400invalid_requestThe document has no file — it was not created from a PDF
401invalid_tokenThe key is missing, malformed, or does not exist
401token_expiredThe key passed its expiry date
401token_revokedThe key was revoked
403insufficient_scopeThe key does not carry read:knowledge_base
404not_foundThe brand does not exist, document_id does not belong to this brand, or this key is not allowed to reach it
429rate_limitedOver 300 requests per minute

Notes

The URL expires in 60 seconds. Use it immediately rather than caching it — download the file right after this call, and re-call this endpoint for a fresh URL if it expires.

Only PDF-sourced documents have a file at all. A paste document (or a legacy mcp one) returns 400 invalid_request here. Check source_type first with Get knowledge document or List knowledge documents if you’re not sure which kind you have.

Last updated on