Search your network and get detailed research profiles on people using the Happenstance API.
Documentation: https://developer.happenstance.ai
All requests require the HAPPENSTANCE_API_KEY environment variable. Pass it as a Bearer token:
Authorization: Bearer $HAPPENSTANCE_API_KEY
Base URL: https://api.happenstance.ai
GET /v1/usageSearch for people across groups and connections. Searches run asynchronously.
Start a search:
curl -s -X POST https://api.happenstance.ai/v1/search \
-H "Authorization: Bearer $HAPPENSTANCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "engineers who have worked on AI infrastructure",
"include_my_connections": true,
"include_friends_connections": true
}'
You can also search within specific groups by adding "group_ids": ["uuid1", "uuid2"]. Get group IDs from GET /v1/groups.
At least one search source is required: group_ids, include_my_connections: true, or include_friends_connections: true.
Response:
{"id": "search-uuid", "url": "https://happenstance.ai/search/search-uuid"}
Poll for results (every 5-10 seconds until status is COMPLETED or FAILED):
curl -s https://api.happenstance.ai/v1/search/SEARCH_ID \
-H "Authorization: Bearer $HAPPENSTANCE_API_KEY"
Completed response includes:
status: RUNNING, COMPLETED, or FAILEDresults: array of people, each with id, name, current_title, current_company, summary, weighted_traits_score, socials (with happenstance_url, linkedin_url, twitter_url), mutuals, and traitshas_more: boolean indicating if more results are availablemutuals: top-level array of mutual connections (results reference these by index)traits: top-level array of trait definitions (results reference these by index)When has_more is true on a completed search, get additional results that exclude all previously returned people. Costs 2 credits.
curl -s -X POST https://api.happenstance.ai/v1/search/SEARCH_ID/find-more \
-H "Authorization: Bearer $HAPPENSTANCE_API_KEY"
Response:
{"page_id": "page-uuid", "parent_search_id": "search-uuid"}
Then poll with the page_id:
curl -s "https://api.happenstance.ai/v1/search/SEARCH_ID?page_id=PAGE_ID" \
-H "Authorization: Bearer $HAPPENSTANCE_API_KEY"
Get a detailed professional profile for a specific person. Runs asynchronously.
Start research:
curl -s -X POST https://api.happenstance.ai/v1/research \
-H "Authorization: Bearer $HAPPENSTANCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"description": "Garry Tan, CEO of Y Combinator, @garrytan on Twitter"}'
Include as many details as possible (full name, company, title, location, social handles) for best results.
Response:
{"id": "research-uuid"}
Poll for results (every 5-10 seconds until status is COMPLETED, FAILED, or FAILED_AMBIGUOUS):
curl -s https://api.happenstance.ai/v1/research/RESEARCH_ID \
-H "Authorization: Bearer $HAPPENSTANCE_API_KEY"
Completed response includes a profile object with:
person_metadata: full_name, alternate_names, profile_urls, current_locations, taglineemployment: array of jobs with company_name, job_title, start_date, end_date, descriptioneducation: array with university_name, degree, start_date, end_dateprojects: array with title, description, urlswritings: array of publications with title, description, date, urlshobbies: array with descriptionsummary: overall text summary with supporting urlsGet the groups you can search within:
curl -s https://api.happenstance.ai/v1/groups \
-H "Authorization: Bearer $HAPPENSTANCE_API_KEY"
Returns {"groups": [{"id": "uuid", "name": "Group Name"}, ...]}.
curl -s https://api.happenstance.ai/v1/usage \
-H "Authorization: Bearer $HAPPENSTANCE_API_KEY"
Returns balance_credits, has_credits, purchases, usage history, and auto_reload settings.
Errors use RFC 7807 format:
{"type": "about:blank", "title": "Bad Request", "status": 400, "detail": "Description must not be empty", "instance": "/v1/research"}
Key status codes:
401: Invalid or missing API key402: Insufficient credits429: Too many concurrent requests (max 10 running searches or research requests)500/503: Server error, retry with backoff共 1 个版本