Developer quickstart
The Velacent Data API lets your software send and receive patient data by API. Send HL7 v2, FHIR R4 or your own JSON; receive FHIR R4 JSON or HL7 v2. There is no proprietary data model to learn: what you receive is FHIR R4 (US Core where it applies) or the HL7 v2 your partner sends.
Every step below shows the raw HTTP call and the same step with the official TypeScript or Python SDK. The SDKs are optional: standard FHIR client libraries that support a bearer token work with the API too, and so does curl.
1. Get a client
An administrator of the organization you work with opens Developers in the Velacent Bridge console and creates an API client:
- Environment: start with Test. Test clients use the sandbox at
/sandbox/v1: synthetic data only, never billed, nothing reaches a real system. - Authentication: Private key (recommended): you register a public key (PEM or JWKS) and sign a short assertion with the private key, which never leaves your systems. Or client secret: Velacent Bridge shows the secret once; store it in your secret manager.
- Scopes: what the client may do (send messages, receive events, read the request log, manage webhooks).
The console then shows the token URL, the base URL and copy-paste samples in curl, Python and Node.js.
2. Get a token
curl -s -u "$CLIENT_ID:$VELACENT_CLIENT_SECRET" -d grant_type=client_credentials \
https://api.example.velacent.com/oauth/token
With an SDK there is nothing to call: the token is fetched on the first request, cached for its 15 minutes and refreshed for you.
import { Velacent } from "@velacent/sdk";
const client = new Velacent({ sandbox: true }); // reads VELACENT_CLIENT_ID, VELACENT_CLIENT_SECRET, VELACENT_HOST
from velacent import Velacent Bridge
client = Velacent(sandbox=True) # reads VELACENT_CLIENT_ID, VELACENT_CLIENT_SECRET, VELACENT_HOST
Tokens last 15 minutes. With a private key, send client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer and a client_assertion signed RS384 or ES384, with iss and sub set to your client ID, aud set to the token URL, an expiry at most 5 minutes after it is issued and a unique jti (the SMART Backend Services form).
3. Send your first test message
curl -s https://api.example.velacent.com/sandbox/v1/messages \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/fhir+json" \
-H "Idempotency-Key: $(uuidgen)" \
--data '{"resourceType":"Patient","meta":{"tag":[{"system":"https://velacent.com/sandbox","code":"synthetic"}]},"identifier":[{"value":"SBX-000001"}],"name":[{"family":"SandboxPatient"}],"birthDate":"1900-01-01"}'
await client.messages.sendFhir(client.sandbox.syntheticPatient()); // an Idempotency-Key is added for you
client.messages.send_fhir(client.sandbox.synthetic_patient()) # an Idempotency-Key is added for you
The sandbox accepts synthetic data only. HL7 v2 messages need processing ID T in MSH-11 and patient identifiers starting SBX- or TEST-; FHIR resources need the synthetic tag above. Anything that looks like a real patient is refused with synthetic_data_required.
4. See it in the request log
Every response carries X-Request-ID. Find the request again:
curl -s https://api.example.velacent.com/sandbox/v1/requests/$REQUEST_ID -H "Authorization: Bearer $TOKEN"
The log holds metadata only (status, error code, timing), kept 30 days. You can also search by idempotency_key, time and status.
5. Receive your first webhook
curl -s https://api.example.velacent.com/sandbox/v1/webhooks -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" --data '{"url":"https://your-app.example.com/velacent"}'
curl -s -X POST https://api.example.velacent.com/sandbox/v1/trigger -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" --data '{"kind":"adt"}'
import { createWebhookHandler } from "@velacent/sdk/webhooks";
const handler = createWebhookHandler({ secret, onEvent: (event) => console.log(event.type) });
http.createServer((req, res) => void handler(req, res)).listen(8443); // verifies, answers the challenge, de-duplicates
from velacent.webhooks import wsgi_app
app = wsgi_app(secret, lambda event: print(event["type"])) # verifies, answers the challenge, de-duplicates
Your endpoint first receives a webhook.verification event: answer 200 with {"challenge": "<the value>"}. Then the synthetic event arrives, signed. See Webhooks and events to verify the signature.
6. Read your first patient
The sandbox holds a few synthetic patients (generated by Synthea, an open-source patient simulator), so a read returns data from the first call. Find a patient by an identifier you hold, then read its results, in standard FHIR R4:
curl -s "https://api.example.velacent.com/sandbox/v1/fhir/Patient?identifier=http%3A%2F%2Fhospital.smarthealthit.org%7Cd8bb1b82-8deb-201a-0fe8-308f79ce31a8" \
-H "Authorization: Bearer $TOKEN" -H "Accept: application/fhir+json"
curl -s "https://api.example.velacent.com/sandbox/v1/fhir/Observation?patient=d8bb1b82-8deb-201a-0fe8-308f79ce31a8&_count=5" \
-H "Authorization: Bearer $TOKEN" -H "Accept: application/fhir+json"
const patient = await client.fhir.findPatientByIdentifier("http://hospital.smarthealthit.org", "d8bb1b82-8deb-201a-0fe8-308f79ce31a8");
for await (const obs of client.fhir.searchAll("Observation", { patient: patient.id!, _count: 5 })) { console.log(obs.id); }
patient = client.fhir.find_patient_by_identifier("http://hospital.smarthealthit.org", "d8bb1b82-8deb-201a-0fe8-308f79ce31a8")
The answers are FHIR searchset Bundles with next links. To see the same patient on your webhook, trigger an event about it: POST /sandbox/v1/trigger with {"kind": "oru", "patient": "d8bb1b82-8deb-201a-0fe8-308f79ce31a8"}. The console's quickstart for your client shows this step in curl, Python and Node.js with the patient filled in. See Partner FHIR access for how reads work on a provider's link.
Errors, retries and limits
- Errors are
application/problem+jsonwith a stablecode(for exampleroute_not_bound,rate_limited) and therequest_id. - Send an
Idempotency-Keywith every POST: a retry with the same key and body gets the first answer and never creates a second message. - Every response has
RateLimit-Limit,RateLimit-RemainingandRateLimit-Reset; over the limit you get429withRetry-After. - Pin a version with
Velacent-API-Version.
The SDKs handle these for you: they add the Idempotency-Key, retry 429 and 503 after Retry-After and raise typed errors with the code and request_id.
The full contract is the OpenAPI 3.1 description, with an importable request collection. The official TypeScript and Python SDKs are generated from it and stay in step with it; for another language, generate a client from the same description.
Going to production
Ask the administrator for a Production client. It is limited to the message types and routes the administrator chooses: a message that would take a route your client is not bound to is refused with route_not_bound before anything is stored. Static API keys are not offered: tokens always come from a private key or a rotatable secret.
Something unclear or missing? Ask Help in the Velacent Bridge console; answers link to the right screen. How support works.