Developer

Build with Happenstance and manage API access and usage.

Quickstart

Get started with the Happenstance API.

1

Create API key

You'll need an API key to authenticate your requests.

2

Send a message

Returns a chat ID and a turn ID. Chat turns have variable cost depending on how much work is done, often 1–4 credits.

curl -X POST https://api.happenstance.ai/v1/chat \
  -H "Authorization: Bearer $YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Who do we know that would make a great angel investor for us?"
  }'
3

Get the reply

Poll until the status is no longer queued or running. Turns that search usually take 1 to 3 minutes.

curl -X GET https://api.happenstance.ai/v1/chat/$CHAT_ID/turns/$TURN_ID \
  -H "Authorization: Bearer $YOUR_API_KEY"
4

(Optional) Continue the chat

Chat keeps the conversation. Returns the turn ID to poll.

curl -X POST https://api.happenstance.ai/v1/chat/$CHAT_ID/messages \
  -H "Authorization: Bearer $YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Draft an intro request to the first one"
  }'