Skip to main content

1. Get your API key

Open the dashboard, select your workspace and environment, then go to Settings → API keys → Create API key. Copy the key when it appears and keep it on your server.
Your key selects Development or Production. Both use https://api.thred.dev. Choose cURL, JavaScript, or Python below. JavaScript runs on your server with Node.js: save a snippet as example.mjs and run node example.mjs. For Python, install Requests with python -m pip install requests. All snippets read the API key set above.
Before calling, check Settings → Calling and Settings → Phone numbers to confirm calling is enabled and an enabled default caller number is configured. Development calls also dial real phone numbers.

2. Start a collection

Replace to with the phone number you want to call, including its country code. Put known context values in input and define the answers you want as a JSON Schema in output. Here, input.date tells Thred which day to ask about. input is optional and defaults to an empty object. The output is always an object, so no top-level type is needed.
Thred accepts the request and returns 202 Accepted with the collection’s ID. IDs use the call_ prefix:

3. Get the answer

Replace the example ID with the ID returned by your collection:
Check every few seconds until status is completed, incomplete, failed, or canceled. While the status is processing or awaiting_review, the result is still being prepared. A completed response includes your answers in data:
Result excerpt
If the collection is incomplete, use the answers in partial_data and check missing_fields. A failed or canceled collection may have no result. That’s the basic flow. Change instructions, input, and output to build your own use case, or see Create a collection for all available fields.