Mock implementation of the Happenstance API for generating synthetic relationship-intelligence data
Project description
mock-happenstance-api
This is a public-source project — see CONTRIBUTING.md for the PR policy.
A deterministic, self-hosted mock of the Happenstance relationship-intelligence API — same endpoints, request/response shapes, and async job-polling behavior as the real API, backed by a synthetic VC/startup-flavored people graph instead of real data.
Built for projects that need a Happenstance connector but have no access to (or need for) the real, paid API while developing.
Quickstart
uv sync
make seed # generates happenstance.db from a fixed seed
make dev # serves the API on http://localhost:8000
curl -s http://localhost:8000/v1/search -H "Authorization: Bearer test" \
-H "Content-Type: application/json" \
-d '{"text": "biotech founders in Boston"}'
Any non-empty bearer token is accepted — there's no real key management.
Endpoints
POST /v1/search, GET /v1/search/{id}, POST /v1/search/{id}/find-more,
POST /v1/research, GET /v1/research/{id}, GET /v1/users/me,
GET /v1/usage, GET /v1/groups, GET /v1/groups/{id} — mirroring the real
API's shape (see developer.happenstance.ai).
Data model
make seed deterministically generates ~300-500 synthetic people, ~40-60
companies, and ~15-20 co-investor groups, all connected by a real graph of
colleague/connection/co-investor/advisor/board edges. Search, mutuals,
@mention filtering, and warm-intro paths all read from that graph rather
than being randomized per call.
Testing error paths
X-Mock-Force-Status: 402or429header forces that error on any request.- A research
descriptioncontaining__FAIL__or__FAIL_AMBIGUOUS__forces that terminal research status. HAPPENSTANCE_MOCK_DELAY=realistic(env var) simulates the real API's 30-60s (search) / 1-3min (research)RUNNING→COMPLETEDdelay instead of completing instantly.
Development
make test # pytest
make lint # ruff + pyright
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mock_happenstance_api-0.1.0.tar.gz.
File metadata
- Download URL: mock_happenstance_api-0.1.0.tar.gz
- Upload date:
- Size: 25.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33278040571ecffc38258206b4195405eb52b45f185af3f40021319c08e8ff2d
|
|
| MD5 |
55e57137ea53669aa86d6d16a1c38c54
|
|
| BLAKE2b-256 |
34cd918e8c76e587d25172c65c3f09edb4ff37de9001e6ee6fc75ac626a2fbcb
|
File details
Details for the file mock_happenstance_api-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mock_happenstance_api-0.1.0-py3-none-any.whl
- Upload date:
- Size: 28.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f7a1af6e62adcefb8d2ae1094f60750e2027e4dc5dc4d31e06a9feab7b4338d
|
|
| MD5 |
737bb385f871b193ed21b4bc155ef7e2
|
|
| BLAKE2b-256 |
e9548d63a62004b89afa3761e763c1ce25d0bc3266bd240141cb5590f75c3d87
|