Quickstart
Upload a document and get your first cited answer, in four requests.
This is the whole loop: create a place for documents, put one in, wait for it to be indexed, then ask about it. Four requests, about five minutes including ingestion.
Before you start
You need an API key. Open the console, pick an app, and copy the key from the API key card in the sidebar — the value is masked on screen but copies in full.
Keep it in an environment variable rather than pasting it into code. Every sample on this site reads DANESHYAR_API_KEY:
export DANESHYAR_API_KEY=dk_live_…Four requests
Create a workspace
A workspace is the boundary answers are retrieved within. Save the id it returns — every other request in this guide needs it.
curl -X POST "https://api.daneshyar.info/api/v1/workspaces/" \ -H "X-API-Key: dk_live_9f3aC2xQ7mB1vT8sE4nK6pR0jY5wZ2hL" \ -H "Content-Type: application/json" \ -d '{ "title": "Cardiology intake", "description": "Patient handbooks and discharge protocols" }'Response{ "status": "ok", "data": { "id": "8f14e45f-ceea-467a-9f4c-1a2b3c4d5e6f", "title": "Cardiology intake", "description": "Patient handbooks and discharge protocols", "share_token": "s7Kd0pLm2Qx", "created_at": "2026-08-05T09:14:22.118Z", "updated_at": "2026-08-05T09:14:22.118Z" } }Upload a document
The upload is multipart, and the only required part is the file itself. The response comes back immediately with status queued: the file has been accepted, not yet indexed.
curl -X POST "https://api.daneshyar.info/api/v1/workspaces/8f14e45f-ceea-467a-9f4c-1a2b3c4d5e6f/resources/" \ -H "X-API-Key: dk_live_9f3aC2xQ7mB1vT8sE4nK6pR0jY5wZ2hL" \ -F "file=@discharge-protocol-2026.pdf" \ -F "title=Discharge protocol 2026"Response{ "status": "ok", "data": { "id": "3c9a1b77-0d24-4e8b-b0f1-7a5e9c2d4b81", "title": "Discharge protocol 2026.pdf", "type": "pdf", "file_url": "https://api.daneshyar.info/media/resources/discharge-protocol-2026.pdf", "extension": "pdf", "size": 482913, "status": "queued", "summary": "", "key_notes": [], "error_message": "", "workspace_id": "8f14e45f-ceea-467a-9f4c-1a2b3c4d5e6f", "created_at": "2026-08-05T09:20:41.702Z", "updated_at": "2026-08-05T09:20:41.702Z" } }Wait until it's ready
Ingestion is asynchronous — extract, split, embed. Poll the resource until its status is ready. A short PDF takes a few seconds; a long video takes minutes.
curl "https://api.daneshyar.info/api/v1/workspaces/8f14e45f-ceea-467a-9f4c-1a2b3c4d5e6f/resources/3c9a1b77-0d24-4e8b-b0f1-7a5e9c2d4b81/" \ -H "X-API-Key: dk_live_9f3aC2xQ7mB1vT8sE4nK6pR0jY5wZ2hL" \ | grep -o '"status": *"[^"]*"'Asking a question before any resource is ready still returns an answer, but it will be a generic one with no citations. Wait for ready before you judge the quality.Ask a question
Send the question with an external_user_id — your own identifier for whoever is asking. The answer arrives with citations naming the passages it came from.
curl -X POST "https://api.daneshyar.info/api/v1/workspaces/8f14e45f-ceea-467a-9f4c-1a2b3c4d5e6f/chat/" \ -H "X-API-Key: dk_live_9f3aC2xQ7mB1vT8sE4nK6pR0jY5wZ2hL" \ -H "Content-Type: application/json" \ -d '{ "external_user_id": "user_4821", "message": "How long do anticoagulant patients stay under observation?" }'Response{ "status": "ok", "data": { "session": { "id": "b6d2e1a4-77c3-4f59-9a10-2e8d6c4b0f37", "title": "Anticoagulant discharge window", "workspace_id": "8f14e45f-ceea-467a-9f4c-1a2b3c4d5e6f", "created_at": "2026-08-05T10:02:11.004Z", "updated_at": "2026-08-05T10:02:14.551Z" }, "user_message": { "id": "5e2c8a03-49bd-4c17-8f6a-31d0b7e5a924", "role": "user", "content": "How long do anticoagulant patients stay under observation?", "response": null, "citations": [], "resource_ids": [], "image_url": null, "created_at": "2026-08-05T10:02:11.219Z" }, "assistant_message": { "id": "7c1b4e90-2af6-4d38-b5c1-8e07a3f62d15", "role": "assistant", "content": "Patients on anticoagulants require a 48-hour observation window before discharge.", "response": { "type": "answer", "parts": [ { "text": "Patients on anticoagulants require a 48-hour observation window before discharge.", "source": { "chunk_id": "e0c9a71d-5b32-4f88-9a04-6c1d2e83f507", "resource_id": "3c9a1b77-0d24-4e8b-b0f1-7a5e9c2d4b81", "resource_title": "Discharge protocol 2026.pdf", "chunk_index": 7, "metadata": { "source_type": "pdf", "page": 4 } } } ], "form": null }, "citations": [ { "resource_id": "3c9a1b77-0d24-4e8b-b0f1-7a5e9c2d4b81", "resource_title": "Discharge protocol 2026.pdf", "chunk_index": 7, "metadata": { "source_type": "pdf", "page": 4 } } ], "resource_ids": ["3c9a1b77-0d24-4e8b-b0f1-7a5e9c2d4b81"], "image_url": null, "created_at": "2026-08-05T10:02:14.480Z" } } }The response carries both a flat
contentstring and a structuredresponseobject. Usecontentto display the answer andcitationsto show its sources.
What to do next
That's the whole surface. From here, the two things worth reading before you build for real are how workspaces should be shaped and how retrieval decides what to quote.