Quickstart

Get verified answers from your documents in a few minutes. Choose how you want to use Docket.

Set this up with your AI agent

Add Docket's REST API to this project's server code.

Docket answers questions from my own documents and returns the answer with the lines it came from. It is hosted at https://YOUR_HOST. Docs: https://YOUR_HOST/docs?page=rest-api

What to do
1. Look at the project first: the language, the framework, and where server code and HTTP calls live. If something important is unclear, ask me one short question before you change anything.
2. Write one server-side function, for example askDocket(question), that sends:
     POST https://YOUR_HOST/api/v1/query
     Authorization: Bearer <secret key>
     Content-Type: application/json
     { "query": "<the question>" }
   and returns reply, verified and citations from the JSON response. Each citation has file, startLine, endLine and verified.
3. Read the key from an environment variable named DOCKET_API_KEY. Add DOCKET_API_KEY= (empty) to .env.example and make sure .env is listed in .gitignore. Do not ask me to paste the key into this chat: I will add it to my .env file myself.
4. If the app has a user interface, expose the function through the app's own server endpoint and have the frontend call that. The key must stay on the server.
5. Show reply to the user. When verified is false, reply already holds a safe fallback message, so it can be shown as it is.
6. Handle errors. 401 with code UNAUTHORIZED means the key is wrong or revoked. 429 means a rate limit: wait the number of seconds in the Retry-After header and retry once. For any other failure, show a short message, not a stack trace.
7. Check it works once the key is set: call the function with a question my documents answer (for example "What is the refund policy?") and print reply and citations. If I have not set the key yet, tell me what to add and stop there.

Rules
- Use a secret key. It starts with sk_live_ and I create it in Studio: open the group, go to Keys, choose Secret.
- Never put the secret key in code, in a browser bundle, in a log or in a commit.
- Each request is independent: the endpoint does not remember earlier questions, and it returns the answer in one piece, not streamed.

When you finish, list the files you changed. Do not change anything unrelated.
  1. 1

    Add your documents

    Open Studio, choose Upload document, then create a group with New group and add the document to it. Wait until the document shows as indexed.

  2. 2

    Create a secret key

    Open the group, go to Keys and generate a key of type Secret. It starts with sk_live_. Store it as an environment variable such as DOCKET_API_KEY and keep it on your server.

  3. 3

    Send a question

    curl https://YOUR_HOST/api/v1/query \
    -H "Authorization: Bearer $DOCKET_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{ "query": "What is the refund policy?" }'
  4. 4

    Read the answer

    {
    "success": true,
    "reply": "Pro plans can be refunded within 30 days of purchase.",
    "verified": true,
    "verificationScore": 100,
    "citations": [
    {
    "file": "billing/refunds.md",
    "startLine": 12,
    "endLine": 14,
    "verified": true
    }
    ]
    }

    Show reply to your user. citations lists the file and line range behind the answer. When verified is false, reply already holds a safe fallback message, so you can show it as it is.

    Every field is described in the REST API reference.

Credits

Each answer is billed from your credit balance in Studio. When the balance reaches zero, answers pause until you top up.