Generate an API Client
Generate a typed SheerID API client from our OpenAPI spec instead of hand-writing HTTP calls — a TypeScript walkthrough plus tooling links for other languages.
What You’ll Build
A typed SheerID API client generated directly from our OpenAPI specification, then used to start a verification and check its status — without hand-writing a single HTTP call or request/response type.
Prerequisites
- Node.js (to run the generator via
npx) or any environment that can run OpenAPI Generator. - An API access token — see Authentication and API Tokens.
- A published verification program and its
programId.
Why generate a client
SheerID publishes a machine-readable OpenAPI specification. Code-generation tools turn that spec into a ready-to-use client library in your language, giving you:
- Typed models for every request and response — your editor autocompletes fields and your compiler catches mistakes.
- Less boilerplate — no hand-written
fetch/axioscalls, URL building, or JSON shapes. - Easy upgrades — regenerate when the API changes and let the compiler flag what moved.
Where the spec lives
| Resource | URL |
|---|---|
| OpenAPI spec (raw) | https://services.sheerid.com/rest/v2/swagger.yaml |
| Interactive reference | REST API 2.0 Reference |
| Base URL | https://services.sheerid.com/rest/v2 |
Worked example: a TypeScript client
This uses OpenAPI Generator to produce a
typescript-axios client.
1. Generate the client
npx @openapitools/openapi-generator-cli generate \
-i https://services.sheerid.com/rest/v2/swagger.yaml \
-g typescript-axios \
-o ./sheerid-client
This writes a typed client into ./sheerid-client. SheerID’s verification endpoints are tagged
verification, so the generator creates a VerificationApi class with one method per operation.
2. Install the runtime dependency
npm install axios
3. Start a verification and check its status
import { Configuration, VerificationApi } from "./sheerid-client";
// The base URL comes from the spec's servers entry: https://services.sheerid.com/rest/v2
// accessToken is sent as: Authorization: Bearer <token>
const config = new Configuration({
accessToken: process.env.SHEERID_TOKEN,
});
const api = new VerificationApi(config);
// Start a student verification and submit personal info in one request.
// The exact body fields vary by verification type — see Required Fields in the Reference.
const { data } = await api.submitStudentVerificationWithProgramId("YOUR_PROGRAM_ID", {
firstName: "Test",
lastName: "User",
email: "[email protected]",
birthDate: "2000-01-01",
organization: { id: 1234, name: "The University of Example" },
});
console.log(data.currentStep); // e.g. "success", "docUpload", "pending"
// Later, fetch the current state of that verification:
const status = await api.getVerificationStatus(data.verificationId);
console.log(status.data.currentStep);
operationId in the spec. Browse the generated apis/ folder or the interactive reference to discover the full set. Request body fields differ per verification type — see Required Fields.
Other languages and tools
The same spec generates clients in 50+ languages. Point any of these tools at
https://services.sheerid.com/rest/v2/swagger.yaml:
| Tool | Use it for |
|---|---|
| OpenAPI Generator | Clients in 50+ languages (Java, Python, Go, C#, PHP, Ruby, and more). |
| Swagger Codegen | The original Swagger code generator; similar language coverage. |
| openapi-typescript | Lightweight TypeScript types (no runtime client) for use with fetch. |
Next Steps
- REST API quickstart — the end-to-end verification flow.
- Authentication — how to obtain and send a token.
- Errors — how to handle API errors and retries.