|
| 1 | +# audd-openapi |
| 2 | + |
| 3 | +[](https://github.com/AudDMusic/audd-openapi/actions/workflows/ci.yml) |
| 4 | + |
| 5 | +The canonical OpenAPI 3.1 specification for the [AudD](https://audd.io) music recognition API. |
| 6 | + |
| 7 | +This repository is the source of truth that all official AudD SDKs build their typed models against. Third parties can also use this spec to generate their own clients. |
| 8 | + |
| 9 | +| File | Purpose | |
| 10 | +|---|---| |
| 11 | +| [`openapi.yaml`](./openapi.yaml) | OpenAPI 3.1 spec covering every public AudD endpoint | |
| 12 | +| [`fixtures/`](./fixtures/) | Real captured API responses, PII scrubbed — used by every SDK's contract tests | |
| 13 | +| [`tests/validate.py`](./tests/validate.py) | Validates each fixture against its schema in `openapi.yaml` | |
| 14 | +| [`tests/capture_fixtures.py`](./tests/capture_fixtures.py) | Re-capture fixtures from the live API (requires an api_token) | |
| 15 | + |
| 16 | +## What's covered |
| 17 | + |
| 18 | +- **Standard recognition** — `POST/GET https://api.audd.io/` |
| 19 | +- **Enterprise recognition** — `POST https://enterprise.audd.io/` (hours- to days-long files) |
| 20 | +- **Stream management** — `setCallbackUrl`, `getCallbackUrl`, `addStream`, `getStreams`, `setStreamUrl`, `deleteStream` |
| 21 | +- **Longpoll** — `GET /longpoll/` |
| 22 | +- **Custom catalog upload** — `POST /upload/` (special access required) |
| 23 | +- **Lyrics search** — `POST /findLyrics/` |
| 24 | + |
| 25 | +The WebSocket recognition variant is intentionally not modeled — AudD recommends the HTTP endpoints for all use cases. |
| 26 | + |
| 27 | +## Validate locally |
| 28 | + |
| 29 | +```bash |
| 30 | +python -m venv .venv |
| 31 | +source .venv/bin/activate |
| 32 | +pip install -r requirements-dev.txt |
| 33 | +python tests/validate.py |
| 34 | +``` |
| 35 | + |
| 36 | +To re-capture fixtures from the live API: |
| 37 | + |
| 38 | +```bash |
| 39 | +AUDD_TEST_TOKEN_STD=... AUDD_TEST_TOKEN_ENTERPRISE=... \ |
| 40 | + python tests/capture_fixtures.py |
| 41 | +python tests/scrub_fixtures.py |
| 42 | +``` |
| 43 | + |
| 44 | +## Generate a client |
| 45 | + |
| 46 | +This spec is hand-written and validates against real fixtures. You can use it with any OpenAPI-compatible code generator. Note that AudD's official SDKs are hand-written rather than generated — to maximize idiomatic feel in each language — but they validate against this same spec. |
| 47 | + |
| 48 | +## Contract drift detection |
| 49 | + |
| 50 | +When this repo lands a change to `openapi.yaml` or `fixtures/`, a workflow fires `repository_dispatch` events at the nine SDK repos that have a separate contract workflow (audd-python, audd-node, audd-go, audd-rust, audd-php, audd-swift, audd-kotlin, audd-dotnet, audd-java) to re-run their contract tests against the new spec. Those nine SDKs also run the same contract tests on a daily cron at 06:00 UTC as a safety net. The audd-c and audd-cpp SDKs validate their parsers against fixtures inside their main CI build instead. |
| 51 | + |
| 52 | +## License |
| 53 | + |
| 54 | +MIT — see [LICENSE](./LICENSE). |
| 55 | + |
| 56 | +## Support |
| 57 | + |
| 58 | +- Documentation: https://docs.audd.io |
| 59 | +- Tokens: https://dashboard.audd.io |
| 60 | +- Email: api@audd.io |
0 commit comments