Share and connect
Use the API and webhooks
Create an API key, call the API from your code and get a webhook when a forecast finishes.
Steps
- Open Settings, choose API and AI clients, then Create new key.
- Name the key, tick what it may do, choose when it expires and choose Create key.
- Copy the key straight away. Prolepsia shows it only once.
- Choose API reference, then Authorize, and paste your key to try calls from the browser.
- Create a question with a POST to /api/v1/external/questions.
- Start a forecast with a POST to /api/v1/external/questions/{question_id}/forecasts. It returns a task ID straight away.
- Read the forecast with a GET to /api/v1/external/forecasts/{task_id} until its status is completed, failed or cancelled.
- To skip polling, open the Webhooks tab in Settings and choose Add webhook. Prolepsia calls your server when a forecast finishes.
Good to know
- Send the key in the Authorization header as Bearer, or in the X-Api-Key header.
- Check each webhook call with its signing secret, which Prolepsia shows once when you add the webhook.