The repository contains OpenAPI definition files for various Fingerprint Server-side APIs.
You can find the schemas definitions in the schemas folder. You can find information about OpenAPI 3.0.3 in the official specification.
- If you are not familiar with the OpenAPI format, you can watch this video summary (1.5x speed recommended).
- Authoring schemas is easier with IDE support. For VS Code, you can use OpenAPI (Swagger) Editor. You can look for similar extensions for your IDE of choice.
- OpenAPI schema is repetitive, the easiest way to add something (schema, endpoint, response, property...) is to copy-paste an existing entity and modify it. Try to follow the established patterns for naming, ordering, example values, example files, etc.
- You can reference the OpenAPI specification for more information.
- If you are adding a new signal, please also add it to
get_event_200.json,webhook.json,get_event_200_all_errors.jsonand other relevant files in theexamplesfolder.
Use the included Swagger UI demo app to dynamically render your changes into a documentation site a preview them there. Some mistakes and inconsistencies are much easier to spot in rendered documentation than by looking at the raw schema.
- Clone this repository:
git clone https://github.com/fingerprintjs/fingerprint-pro-server-api-openapi.git - Install dependencies:
pnpm install - Run
pnpm devto start the demo app
Code of demo application is in src folder.
- Your IDE (with the right extensions/plugins) should warn you if your schema does not follow the OpenAPI specification.
- You can also run
pnpm run lintSchemato run your schema through a linter. - This check also runs in the CI pipeline for your PR.
This repository includes a schema diff script used by CI to post a sticky PR comment with schema changes vs currently published GitHub Pages schemas.
Run it locally:
- Install dependencies:
pnpm install - Build local schemas:
pnpm build - Compare local build output (
dist/schemas) with published schemas:pnpm schema:diff:published
Optional:
- Save a JSON report:
pnpm schema:diff:published -- --json-out ./tmp/schema-diff-report.json - Save the rendered PR comment body:
pnpm schema:diff:published -- --comment-out ./tmp/schema-diff-comment.md - Compare against a custom published base URL:
pnpm schema:diff:published -- --base-url https://fingerprintjs.github.io/fingerprint-pro-server-api-openapi/schemas
The schema is currently created separately from the API code. This is a bad practice, but we will fix it in future API versions. To validate that schema matches the actual API implementation we use a special validation script.
- It validates the schema against JSON examples file from examples folder. Note that some files in the examples folder appear unused like
get_event_extra_fields.json, but they are downloaded and used for validation by individual SDK repositories. - It also generates fresh identification events using the TEST_SUBSCRIPTION env variable, retrieves fresh Server API responses and validates the schema against those.
- You can run
pnpm run validateSchemato validate the schema locally.- You can create a
.envfile according to.env.exampleand set the TEST_SUBSCRIPTIONS variable to include your personal Fingerprint subscription. - Or you can ask the DX team to provide you with the same test subscriptions as are used in the CI pipeline.
- You can create a
- This check also runs in the CI pipeline for your PR and once a day as a scheduled job.
- If you are adding things to the schema, you can also try adding the appropriate validations for the changes to the
validateSchema.tsscript. If you run into problems, the repository maintainers will be happy to help or to add the validations themselves as part of the PR review.
Releases from this repository are propagated to our server-side SDKs, that's why it's important to provide meaningful release notes if there are relevant changes. We use changesets for that. If you want to describe your changes, run:
pnpm run changesetand follow steps in the CLI. It will create a new markdown file in .changeset folder, don't forget to commit it with your changes.
Example changeset looks like this:
---
'fingerprint-pro-server-api-openapi': minor
---
**visitors**: Add the confidence field to the VPN Detection Smart Signalvisitors- scope of the changes. Scopes are defined in the config/scopes.yaml file. Certain scopes are ignored in certain SDKs if they are not supported, meaning that they will be ignored for them. You will be prompted to select scope in the CLI.Add the confidence field to the VPN Detection Smart Signal- meaningful description of the change.fingerprint-pro-server-api-openapi- name of the packageminor- version of the change, can be:patch,minor,major
A changeset is only needed when a change affects the generated SDKs. Pick the version bump as follows:
major- a breaking change: removing a field, schema, endpoint, or query parameter, narrowing a type, or making an optional field required. Very rare, and usually an accidental change to revert.minor- a backwards-compatible addition: new fields, schemas, query parameters, paths, or methods.patch- a backwards-compatible change that isn't an addition, e.g. deprecating a field, or a vendor extension that affects SDK code generation (likex-parameter-alias/x-aliased-parameter-name).
Don't create a changeset for documentation-only changes (descriptions, examples) or for vendor extensions that don't affect the generated SDKs.
On every push into main (merged PR):
- The built schema is published to GitHub pages.
- The built schema is published as a raw yaml file.
- After GitHub Pages deploy, the docs repo OpenAPI sync workflows run. They open a PR only if the published spec changed, which updates the API Reference.
See the publish.yml workflow for more details.
GitHub releases are used to generate Server SDKs based on a specific version of the OpenAPI schema.
After merging to main, if there are relevant changes, you can manually trigger the Release workflow, which will consume created changeset files and create PR with bumped version and updated changelog.
There are server-side SDKs (Node.js, Go, etc.) that consume the schema automatically.
The file .changeset/changesets.zip is used during this process. It is not a build artifact, and it is not safe to delete by hand.
changeset version deletes the markdown files once it has folded them into the changelog, but the
SDK repositories still need the originals to generate their own changelogs when they sync to a new
schema version. So scripts/zipChangesets.ts archives them into .changeset/changesets.zip just
before they are consumed, and that zip is committed as part of the release PR.
Lifecycle:
pnpm changeset-version(run by the changesets release action) zips the pending changesets, thenchangeset versionconsumes the markdown files. The zip lands in the release PR.- On release publish,
.github/workflows/upload-changesets.ymlrunsscripts/uploadChangesets.cjs, which uploads the zip as thechangesets.ziprelease asset that the SDK sync jobs download. - The same workflow then opens a follow-up PR that removes the zip from
main.
Step 3 only runs once the upload in step 2 has succeeded, so a zip that is still on main holds
changesets the SDKs never received. zipChangesets.ts folds those into the next archive instead of
overwriting them, so a failed release delays delivery rather than losing it.