Payerworks writes and explains files; it sends nothing to a payer. What that means
Every call but GET /v1/health sends a key as Authorization: Bearer pw_test_… or pw_live_…. A test key is free from the developers page, for invented data only, and writes test files only; a live key needs a signed business associate agreement first. Your key is a bearer key: keep it on your server, never in browser code.
Every answer carries x-request-id, and every refusal carries the same id as request_id inside the error. Quote it when you write to us. A POST, and PUT /v1/account/webhook, may carry an Idempotency-Key, unless its route says it takes none: a retry with the same key and request within 24 hours is answered as the first call was, by running it again, because Payerworks never keeps an answer.
Routes
- GET
/v1/healthHealth - GET
/v1/accountYour account - GET
/v1/account/contactYour notice address - PUT
/v1/account/contactSet your notice address - GET
/v1/keysYour account’s keys - POST
/v1/keysMake a key - DELETE
/v1/keys/{id}Revoke a key - POST
/v1/keys/{id}/rotateRotate a key - POST
/v1/mcpThe MCP server, hosted - GET
/v1/audit-logYour account’s audit log - GET
/v1/audit-log/exportDownload the audit log
Each route shows its call with curl and with the two clients, then its real answer, shortened, and the fields it holds. The client calls assume one client made once, const pw = new Payerworks() in JavaScript or pw = payerworks.Payerworks() in Python, each reading PAYERWORKS_API_KEY and PAYERWORKS_BASE_URL, and body is the request.json shown.
GET/v1/health
Health
Whether the API is answering. No key needed.
Request
curl -sS -X GET "$PAYERWORKS_BASE_URL/v1/health"With the JavaScript client
const answer = await pw.getHealth();With the Python client
answer = pw.get_health(){
"ok": true,
"service": "Payerworks",
"version": "v1",
"transmits": false
}| Field | Type | What it is |
|---|---|---|
ok | Typeboolean | |
service | Typestring | |
version | Typestring | |
transmits | Typethe value false | What it isNo route transmits to a payer yet. |
GET/v1/account
Your account
The key’s account, label, mode and rate, the calls it made on each day of this month (counted by UTC day) and the calls refused before they ran, and its webhook if one is set, with what its last delivery did.
Request
curl -sS -X GET "$PAYERWORKS_BASE_URL/v1/account" \
-H "Authorization: Bearer $PAYERWORKS_API_KEY"With the JavaScript client
const answer = await pw.getAccount();With the Python client
answer = pw.get_account(){
"key_id": "pwk_0123456789abcdef",
"account": "Sample Billing Co",
"label": "Self-serve",
"mode": "test",
"rpm": 60,
"usage": {
"month": "2026-10",
"days": [
{
"date": "2026-10-18",
"calls": 12,
"refused": 0
},
{
"date": "2026-10-19",
"calls": 4,
"refused": 1
}
],
"total": 16,
"refused": 1
},
"webhook": {
"url": "https://hooks.example.com/payerworks/events",
"secret_last_four": "Osk=",
"created_at": "2026-10-19T15:00:00.000Z",
"previous_secret_expires_at": null,
"last_delivery": {
"at": "2026-10-19T15:00:00.000Z",
"trigger": "sandbox",
"first_event_id": "evt_cc264f7536a9315a0c6fe09f",
"events": 3,
"delivered": 3,
"failed": 0,
"status": 200,
"error": null
}
}
}| Field | Type | What it is |
|---|---|---|
key_id | Typestring | |
account | Typestring | |
label | Typestring | |
mode | Typeone of "test", "live" | |
rpm | Typeinteger | What it isCalls a minute. |
usage | Typeobject | What it isThis month to date, by UTC day. |
webhook | Typeobject or null |
GET/v1/account/contact
Your notice address
Where Payerworks emails you about this key: when one of its webhook destinations keeps failing, and when one of its enrollment requests moves without your doing it. A test key from this page starts with the address its link was sent to, the only address it may set.
Request
curl -sS -X GET "$PAYERWORKS_BASE_URL/v1/account/contact" \
-H "Authorization: Bearer $PAYERWORKS_API_KEY"With the JavaScript client
const answer = await pw.getAccountContact();With the Python client
answer = pw.get_account_contact(){
"email": "dev@example.com",
"updated_at": "2026-11-11T02:55:51.832Z"
}| Field | Type | What it is |
|---|---|---|
email | Typestring or null | |
updated_at | Typestring or null |
PUT/v1/account/contact
Set your notice address
The address told when a destination has failed for 2 hours, for 24 hours, and when it was disabled after its last attempt, and sent one email for every enrollment request that moved without your doing it inside the same 15 minutes. Send email: null to remove it, and nothing is emailed. Only the address that asked for this account’s test key by email (any key of the account may set it), or null; any other address is refused 403 contact_not_proved. A key issued by Payerworks has its address set by us: write to us.
Request
curl -sS -X PUT "$PAYERWORKS_BASE_URL/v1/account/contact" \
-H "Authorization: Bearer $PAYERWORKS_API_KEY" \
-H "Content-Type: application/json" \
-d @request.jsonWith the JavaScript client
const answer = await pw.putAccountContact(body);With the Python client
answer = pw.put_account_contact(body){
"email": "dev@example.com"
}{
"email": "dev@example.com",
"updated_at": "2026-11-11T02:55:51.832Z"
}| Field | Type | What it is |
|---|---|---|
email | Typestring or null | |
updated_at | Typestring or null |
GET/v1/keys
Your account’s keys
Every key of your account in your key’s own mode (a test key lists the test keys, a live key the live ones): its name, mode, last four characters, when it was made, when it expires, when it was last rotated, until when its previous secret is accepted, whether it has expired, when it was revoked, and which one is the key asking, beside the account’s id. A revoked key is listed too. Never a key itself.
Request
curl -sS -X GET "$PAYERWORKS_BASE_URL/v1/keys" \
-H "Authorization: Bearer $PAYERWORKS_API_KEY"With the JavaScript client
const answer = await pw.getKeys();With the Python client
answer = pw.get_keys(){
"account_id": "pwk_0123456789abcdef01",
"data": [
{
"key_id": "pwk_0123456789abcdef01",
"name": "Server",
"mode": "test",
"last_four": "aaaa",
"created_at": "2026-10-19T12:00:00.000Z",
"expires_at": null,
"expired": false,
"revoked_at": null,
"rotated_at": null,
"previous_secret_accepted_until": null,
"current": true
},
{
"key_id": "pwk_c92dad163111102ffbbee26e",
"name": "CI runner",
"mode": "test",
"last_four": "dwV0",
"created_at": "2026-11-11T02:55:51.885Z",
"expires_at": "2027-02-09T02:55:51.885Z",
"expired": false,
"revoked_at": null,
"rotated_at": null,
"previous_secret_accepted_until": null,
"current": false
}
]
}| Field | Type | What it is |
|---|---|---|
account_id | Typestring | What it isThe account: the keys one key started. |
data | Typelist of AccountKey |
POST/v1/keys
Make a key
A named key of your key’s own mode and rate, shown once. expires_in_days (1 to 365) makes it stop on its own. A key never outlives the key that made it: its expiry is the sooner of expires_in_days and the making key’s own, and the making key’s when none is asked. An account holds 3 test keys or 25 live ones that are not revoked. Every key of an account may manage its keys, unless the account’s organization chose members only.
Request
curl -sS -X POST "$PAYERWORKS_BASE_URL/v1/keys" \
-H "Authorization: Bearer $PAYERWORKS_API_KEY" \
-H "Content-Type: application/json" \
-d @request.jsonWith the JavaScript client
const answer = await pw.postKeys(body);With the Python client
answer = pw.post_keys(body){
"name": "CI runner",
"expires_in_days": 90
}{
"key_id": "pwk_c92dad163111102ffbbee26e",
"name": "CI runner",
"mode": "test",
"last_four": "dwV0",
"created_at": "2026-11-11T02:55:51.885Z",
"expires_at": "2027-02-09T02:55:51.885Z",
"expired": false,
"revoked_at": null,
"rotated_at": null,
"previous_secret_accepted_until": null,
"current": false,
"key": "pw_test_nSp1..."
}| Field | Type | What it is |
|---|---|---|
key_id | Typestring | |
name | Typestring | |
mode | Typeone of "test", "live" | |
last_four | Typestring | |
created_at | Typestring | |
expires_at | Typestring or null | |
expired | Typeboolean | |
revoked_at | Typestring or null | |
rotated_at | Typestring or null | |
previous_secret_accepted_until | Typestring or null | |
current | Typeboolean | What it isTrue for the key this call was made with. |
key | Typestring | What it ispw_test_ or pw_live_ and the secret: only in the answer that made it (POST /v1/keys, or a rotation). |
overlap_hours | Typeinteger |
DELETE/v1/keys/{id}
Revoke a key
The key stops working within a minute, and its SFTP user, if it has one, is removed at once. Revoking a key that is already revoked is not an error.
Request
curl -sS -X DELETE "$PAYERWORKS_BASE_URL/v1/keys/pwk_c92dad163111102ffbbee26e" \
-H "Authorization: Bearer $PAYERWORKS_API_KEY"With the JavaScript client
const answer = await pw.deleteKeysById("pwk_c92dad163111102ffbbee26e");With the Python client
answer = pw.delete_keys_by_id("pwk_c92dad163111102ffbbee26e"){
"key_id": "pwk_c92dad163111102ffbbee26e",
"name": "CI runner",
"mode": "test",
"last_four": "8COs",
"created_at": "2026-11-11T02:55:51.885Z",
"expires_at": "2027-02-09T02:55:51.885Z",
"expired": false,
"revoked_at": "2026-11-11T02:55:51.895Z",
"rotated_at": "2026-11-11T02:55:51.892Z",
"previous_secret_accepted_until": "2026-11-12T02:55:51.892Z",
"current": false
}| Field | Type | What it is |
|---|---|---|
key_id | Typestring | |
name | Typestring | |
mode | Typeone of "test", "live" | |
last_four | Typestring | |
created_at | Typestring | |
expires_at | Typestring or null | |
expired | Typeboolean | |
revoked_at | Typestring or null | |
rotated_at | Typestring or null | |
previous_secret_accepted_until | Typestring or null | |
current | Typeboolean | What it isTrue for the key this call was made with. |
key | Typestring | What it ispw_test_ or pw_live_ and the secret: only in the answer that made it (POST /v1/keys, or a rotation). |
overlap_hours | Typeinteger |
POST/v1/keys/{id}/rotate
Rotate a key
A new secret for the same key id, shown once, so its webhooks, events, usage and enrollments carry on. The old secret is still accepted for overlap_hours, 0 to 720, 24 by default, and stops at once if the key is revoked. Two rotations at once: the first finishes, and the other answers 409 key_rotation_conflict and makes nothing.
Request
curl -sS -X POST "$PAYERWORKS_BASE_URL/v1/keys/pwk_c92dad163111102ffbbee26e/rotate" \
-H "Authorization: Bearer $PAYERWORKS_API_KEY" \
-H "Content-Type: application/json" \
-d @request.jsonWith the JavaScript client
const answer = await pw.postKeysByIdRotate("pwk_c92dad163111102ffbbee26e", body);With the Python client
answer = pw.post_keys_by_id_rotate("pwk_c92dad163111102ffbbee26e", body){
"overlap_hours": 24
}{
"key_id": "pwk_c92dad163111102ffbbee26e",
"name": "CI runner",
"mode": "test",
"last_four": "8COs",
"created_at": "2026-11-11T02:55:51.885Z",
"expires_at": "2027-02-09T02:55:51.885Z",
"expired": false,
"revoked_at": null,
"rotated_at": "2026-11-11T02:55:51.892Z",
"previous_secret_accepted_until": "2026-11-12T02:55:51.892Z",
"current": false,
"key": "pw_test_p3oK...",
"overlap_hours": 24
}| Field | Type | What it is |
|---|---|---|
key_id | Typestring | |
name | Typestring | |
mode | Typeone of "test", "live" | |
last_four | Typestring | |
created_at | Typestring | |
expires_at | Typestring or null | |
expired | Typeboolean | |
revoked_at | Typestring or null | |
rotated_at | Typestring or null | |
previous_secret_accepted_until | Typestring or null | |
current | Typeboolean | What it isTrue for the key this call was made with. |
key | Typestring | What it ispw_test_ or pw_live_ and the secret: only in the answer that made it (POST /v1/keys, or a rotation). |
overlap_hours | Typeinteger |
POST/v1/mcp
The MCP server, hosted
The same tools as the downloadable MCP server, over MCP’s Streamable HTTP transport (2026-07-28, and the 2025 handshakes), with your key as the bearer. Each tool call is a call to its route under your key. With a live key no tool is called unless the request carries Payerworks-MCP-Allow-Live-Key: 1. Payerworks transmits nothing.
Request
curl -sS -X POST "$PAYERWORKS_BASE_URL/v1/mcp" \
-H "Authorization: Bearer $PAYERWORKS_API_KEY" \
-H "Content-Type: application/json" \
-d @request.jsonWith the JavaScript client
const answer = await pw.postMcp(body);With the Python client
answer = pw.post_mcp(body){
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-06-18",
"capabilities": {},
"clientInfo": {
"name": "example-client",
"version": "1"
}
}
}{
"jsonrpc": "2.0",
"id": 1,
"result": {
"protocolVersion": "2025-06-18",
"capabilities": {
"tools": {
"listChanged": false
},
"prompts": {
"listChanged": false
}
},
"serverInfo": {
"name": "payerworks",
"title": "Payerworks",
"version": "1.0.0"
},
"instructions": "Each tool calls one route of the Payerworks API with the key this connection presents. Payerworks validates claims, writes and reads X12 files and explains each answer in plain words. It transmits nothing: no file reaches a payer. post_sand…"
}
}Shortened here: lists show their first two items and long strings are cut. The whole answer is this route’s example in /openapi.json.
| Field | Type | What it is |
|---|---|---|
jsonrpc | Typethe value "2.0" | |
id | Typeobject | |
result | Typeobject | |
error | Typeobject | What it isA JSON-RPC error: never the API’s error shape. |
GET/v1/audit-log
Your account’s audit log
Every change to this account, newest first: keys made, rotated, revoked or expired; the webhook, destinations and the notice address; providers, enrollment requests, tasks and documents; the SFTP user and its SSH keys; batch jobs; the organization and its members. Each entry says what, when, who (a key, a member, Payerworks, or Payerworks automatically), through which door, the object’s id, and the fields that changed by name only, never a value; a web address by its host. limit 1 to 100 (25), type (an entry type, or its family before the dot), created_gte and created_lt, starting_after. Each entry is kept 365 days, then deleted, and never changed before then. Every key of the account reads the same log.
Request
curl -sS -X GET "$PAYERWORKS_BASE_URL/v1/audit-log" \
-H "Authorization: Bearer $PAYERWORKS_API_KEY"With the JavaScript client
const answer = await pw.getAuditLog();With the Python client
answer = pw.get_audit_log(){
"object": "list",
"data": [
{
"id": "aud_aeb4acb2fdf610d4bc531306",
"type": "webhook_destination.removed",
"words": "Webhook destination removed",
"at": "2026-11-11T02:55:51.898Z",
"actor": {
"type": "key",
"id": "pwk_0123456789abcdef01"
},
"door": "api",
"object": {
"kind": "webhook_destination",
"id": "wd_41a29f8a49c92190"
},
"changed": [],
"url_host": null,
"count": null,
"request_id": "req_example_15"
},
{
"id": "aud_a08c0b0cd9c2ce25b9ef59ab",
"type": "key.revoked",
"words": "API key revoked",
"at": "2026-11-11T02:55:51.895Z",
"actor": {
"type": "key",
"id": "pwk_0123456789abcdef01"
},
"door": "api",
"object": {
"kind": "key",
"id": "pwk_c92dad163111102ffbbee26e"
},
"changed": [],
"url_host": null,
"count": null,
"request_id": "req_example_14"
}
],
"has_more": true,
"next_cursor": "acur_412331373934333635373531383932236175645f663663623031613433613161613366356130353463653832",
"retention_days": 365
}Shortened here: lists show their first two items and long strings are cut. The whole answer is this route’s example in /openapi.json.
| Field | Type | What it is |
|---|---|---|
object | Typethe value "list" | |
data | Typelist of AuditEntry | What it isNewest first. |
has_more | Typeboolean | |
next_cursor | Typestring or null | What it isPass as starting_after. |
retention_days | Typethe value 365 | What it isEach audit log entry is kept for 365 days (one year) from the moment of the change, then deleted. No entry is overwritten: each is written once, only where no entry of its id is. |
GET/v1/audit-log/export
Download the audit log
The same entries and filters as a CSV file in the answer (csv, filename, columns), at most 5,000 entries a call; next_cursor names where the rest start. No cell opens as a formula in a spreadsheet.
Request
curl -sS -X GET "$PAYERWORKS_BASE_URL/v1/audit-log/export" \
-H "Authorization: Bearer $PAYERWORKS_API_KEY"With the JavaScript client
const answer = await pw.getAuditLogExport();With the Python client
answer = pw.get_audit_log_export(){
"object": "audit_log_export",
"content_type": "text/csv",
"filename": "payerworks-audit-log-2026-11-11.csv",
"row_count": 7,
"columns": [
"id",
"at"
],
"csv": "id,at,type,words,actor_type,actor_id,door,object_kind,object_id,changed,url_host,count,request_id\r\naud_aeb4acb2fdf610d4bc531306,2026-11-11T02:55:51.898Z,webhook_destination.removed,Webhook destination removed,key,pwk_0123456789abcdef01,api,…",
"has_more": false,
"next_cursor": null,
"retention_days": 365
}Shortened here: lists show their first two items and long strings are cut. The whole answer is this route’s example in /openapi.json.
| Field | Type | What it is |
|---|---|---|
object | Typethe value "audit_log_export" | |
content_type | Typethe value "text/csv" | |
filename | Typestring | |
row_count | Typeinteger | What it isAt most 5,000. |
columns | Typelist of one of "id", "at", "type", "words", "actor_type", "actor_id", "door", "object_kind", "object_id", "changed", "url_host", "count", "request_id" | |
csv | Typestring | What it isThe file, CRLF line ends; no cell opens as a formula in a spreadsheet. |
has_more | Typeboolean | |
next_cursor | Typestring or null | What it isPass as starting_after for the rest. |
retention_days | Typethe value 365 | What it isEach audit log entry is kept for 365 days (one year) from the moment of the change, then deleted. No entry is overwritten: each is written once, only where no entry of its id is. |
Reading the answer
- GET /v1/account answers the key’s rate a minute and its usage this month to date, by UTC day, with refused calls counted apart.
- A rotation (POST /v1/keys/{id}/rotate) keeps the key id, so webhooks, events, usage and enrollments carry on; the old secret is accepted only inside the overlap you choose. Every key of an account may manage its keys, unless the account’s organization chose that only its signed-in members do (see Organizations and members).
- GET /v1/audit-log answers who changed what on the account, when and through which door, by field name only, never a value; each entry is kept one year. GET /v1/audit-log/export gives the same entries as a CSV file.
Troubleshooting
invalid_key(401): The key is not valid, or was revoked: a revoked key stops within a minute.rate_limited(429): Over the key’s calls a minute. Wait the seconds retry-after names; the clients do this for you, at most twice.idempotency_key_reused(422): That Idempotency-Key was used in the last 24 hours for a different request. Make a new key for each new request.too_large(413): A request body is at most 2 MB. Larger work is split across calls.invalid_audit_type(400): type names an entry type (key.created) or its family (key).keys_managed_by_members(403): The account’s organization chose that only its signed-in members make, rotate and revoke keys: do it in the console, or ask an owner to switch it back.
Every refusal these routes may answer, with its status. Any route may also answer the codes every route shares, on Every error.
| Code | Status | What it means |
|---|---|---|
invalid_audit_cursor | Status400 | What it meansstarting_after is the next_cursor of an earlier page of this audit log. |
invalid_audit_type | Status400 | What it meanstype is one of the audit log's entry types, or the part before its dot (key, webhook, enrollment...), as the developers page lists them. |
invalid_concurrency | Status400 | What it meansconcurrency is a whole number from 1 to 10: how many deliveries this destination takes at once. |
invalid_contact_email | Status400 | What it meansemail is an address of at most 254 characters, or null to remove it. |
invalid_destination_id | Status400 | What it meansA destination id is wd_ followed by 16 lowercase hexadecimal characters. |
invalid_destination_name | Status400 | What it meansA destination's name is 1 to 80 characters. |
invalid_enabled | Status400 | What it meansenabled is true or false, or left out. |
invalid_event_types | Status400 | What it meansevent_types is a list of the event types the developers page lists; an empty list, or leaving it out, receives every type. |
invalid_expires_in_days | Status400 | What it meansexpires_in_days is a whole number from 1 to 365, or left out for a key that does not expire. |
invalid_idempotency_key | Status400 | What it meansAn Idempotency-Key is 1 to 255 visible characters, with no spaces, quotes or backslashes. A UUID is a good one. |
invalid_json | Status400 | What it meansThe body must be a JSON object. |
invalid_key_id | Status400 | What it meansA key id is pwk_ followed by 16 to 40 letters and digits. |
invalid_key_name | Status400 | What it meansA key's name is 1 to 80 characters. |
invalid_overlap_hours | Status400 | What it meansoverlap_hours is a whole number from 0 to 720: how long the old secret is still accepted after a rotation. |
invalid_key | Status401 | What it meansThat key is not valid. Keys are issued by Payerworks; a revoked key stops within a minute. |
no_key | Status401 | What it meansSend your API key as Authorization: Bearer <key>. |
contact_not_proved | Status403 | What it meansNotices go only to an address Payerworks has proved: the one that asked for this account's test key by email and opened the link we sent. Send that address, or null to stop the notices. To use another, write to us from it. |
keys_managed_by_members | Status403 | What it meansThis account's organization chose that only its signed-in members manage keys. Make, rotate or revoke the key at payerworks.com/console. |
destination_not_found | Status404 | What it meansThis key has no webhook destination with that id. |
key_not_found | Status404 | What it meansThis account has no key with that id. |
not_at_destination | Status404 | What it meansThat event was never sent to this destination (it was made before the destination was added, or its type is filtered out). A ping or a new event will be. |
destination_conflict | Status409 | What it meansThe destination changed while this request ran, so nothing was saved. Send the request again. |
destination_disabled | Status409 | What it meansThis destination is disabled. Enable it with PUT /v1/webhook-destinations/{id} and enabled: true first. |
destination_limit_reached | Status409 | What it meansA key holds at most 10 webhook destinations. Remove one to add another. |
idempotency_in_flight | Status409 | What it meansThe first request with this Idempotency-Key is still running. Retry after the seconds retry-after names. |
key_last_usable | Status409 | What it meansThat is the account's last usable key of its mode, so it was not revoked: without one, no key can be made and the audit log cannot be read. Make a replacement with POST /v1/keys first, then revoke this one. |
key_limit_reached | Status409 | What it meansAn account holds at most 3 test keys or 25 live keys that are not revoked. Revoke one to make another. |
key_revoked | Status409 | What it meansThat key is revoked, so it cannot be rotated. Make a new key with POST /v1/keys. |
key_rotation_conflict | Status409 | What it meansAnother rotation of this key finished while this one ran, so this one made nothing: the secret that other request showed is the key's current one. List the keys with GET /v1/keys, and rotate again if that secret was lost. |
key_settings_out_of_range | Status409 | What it meansThe key's stored rate or account name is outside what a key may hold, so nothing was made or rotated; reason says which. Ask Payerworks to correct the key: sending the request again answers the same. |
too_large | Status413 | What it meansA request body may be at most 2 MB. |
idempotency_key_reused | Status422 | What it meansThis Idempotency-Key was used in the last 24 hours for a different request. Send a new key for a new request. |
rate_limited | Status429 | What it meansOver this key's calls a minute. Wait the seconds retry-after names. |
store_unavailable | Status503 | What it meansWe could not read or write this key's records just now; the message says what was not done. Retry in a moment. |
Code lists
The headers on every answer
| Header | What it says |
|---|---|
x-request-id | What it saysThe request’s id. Quote it when you write to Payerworks. |
x-ratelimit-limit | What it saysThe key’s calls a minute. |
x-ratelimit-remaining | What it saysCalls left in this UTC minute. |
x-ratelimit-reset | What it saysSeconds until the window resets. |
RateLimit | What it saysThe same figures in the IETF draft’s form. |
RateLimit-Policy | What it saysThe key’s policy in the IETF draft’s form. |
idempotent-replayed | What it saystrue when this is the first answer to an Idempotency-Key request, given again. |
retry-after | What it saysSeconds to wait before a retry. |
The audit log’s entry types
An entry names what changed by field name only, never a value: no name, address, note or answer is kept. A web address is kept as its host alone. Each audit log entry is kept for 365 days (one year) from the moment of the change, then deleted. No entry is overwritten: each is written once, only where no entry of its id is.
| Type | What changed | Fields it may name |
|---|---|---|
key.created | What changedAPI key created | Fields it may namename, mode, rpm, expires_at |
key.rotated | What changedAPI key secret rotated | Fields it may namesecret, overlap_hours |
key.revoked | What changedAPI key revoked | Fields it may namenone |
key.expired | What changedAPI key expired | Fields it may namenone |
webhook.set | What changedAccount webhook set | Fields it may nameurl, secret |
webhook.changed | What changedAccount webhook changed | Fields it may nameurl, secret, overlap_hours |
webhook.removed | What changedAccount webhook removed | Fields it may namenone |
webhook_destination.created | What changedWebhook destination added | Fields it may namename, url, event_types, enabled, concurrency, secret |
webhook_destination.changed | What changedWebhook destination changed | Fields it may namename, url, event_types, enabled, concurrency, secret, overlap_hours |
webhook_destination.removed | What changedWebhook destination removed | Fields it may namenone |
contact.changed | What changedNotice contact set | Fields it may nameemail |
contact.removed | What changedNotice contact removed | Fields it may nameemail |
provider.created | What changedProvider added | Fields it may namename, npi, tax_id, tax_id_type, contacts |
provider.changed | What changedProvider changed | Fields it may namename, npi, tax_id, tax_id_type, contacts |
provider.removed | What changedProvider removed | Fields it may namenone |
enrollment.created | What changedEnrollment request created | Fields it may nameprovider_id, payer, transaction, primary_contact, notify_email, requested_effective_date, era_aggregation, ptan, note |
enrollment.changed | What changedEnrollment request changed | Fields it may nameprovider_id, payer, transaction, primary_contact, notify_email, requested_effective_date, era_aggregation, ptan, note |
enrollment.submitted | What changedEnrollment request submitted | Fields it may namenone |
enrollment.withdrawn | What changedEnrollment request withdrawn | Fields it may namereason |
enrollment.withdrawal_requested | What changedWithdrawal of an enrollment request asked of Payerworks | Fields it may namereason |
enrollment.removed | What changedEnrollment request deleted | Fields it may namenone |
enrollment.status_changed | What changedEnrollment request status changed | Fields it may namestatus |
enrollment.imported | What changedEnrollment requests imported from a file | Fields it may namenone |
enrollment.note_added | What changedNote added to an enrollment request | Fields it may namenone |
enrollment_task.answered | What changedEnrollment task answered | Fields it may namevalues |
enrollment_task.added | What changedEnrollment task added | Fields it may namenone |
enrollment_task.superseded | What changedEnrollment task replaced by another | Fields it may namenone |
enrollment_task.completed | What changedEnrollment task marked done | Fields it may namenone |
enrollment_document.requested | What changedEnrollment document upload started | Fields it may namenone |
enrollment_document.added | What changedEnrollment document added | Fields it may namenone |
enrollment_document.removed | What changedEnrollment document removed | Fields it may namenone |
sftp_user.added | What changedSFTP user added | Fields it may nameacknowledgment_999 |
sftp_user.changed | What changedSFTP user changed | Fields it may nameacknowledgment_999 |
sftp_user.removed | What changedSFTP user removed | Fields it may namenone |
sftp_ssh_key.added | What changedSFTP SSH key added | Fields it may namenone |
sftp_ssh_key.removed | What changedSFTP SSH key removed | Fields it may namenone |
job.created | What changedBatch job created | Fields it may nameroute |
job.canceled | What changedBatch job canceled | Fields it may namenone |
job.removed | What changedBatch job and its files deleted | Fields it may namenone |
account_baa.recorded | What changedBusiness associate agreement recorded | Fields it may namesigner_name, signer_title, organization, signed_on, baa_version, reference_prefix |
account_baa.withdrawn | What changedBusiness associate agreement withdrawn | Fields it may namenone |
org.created | What changedOrganization created | Fields it may namename |
org.updated | What changedOrganization changed | Fields it may namename, key_management |
member.invited | What changedMember invited | Fields it may nameemail, role |
member.invitation_canceled | What changedMember invitation canceled | Fields it may namenone |
member.joined | What changedMember joined | Fields it may namenone |
member.role_changed | What changedMember role changed | Fields it may namerole |
member.removed | What changedMember removed | Fields it may namekeys_revoked |
In detail
How the API works
- Run on real claims every day: The remittance reader, the claim status reading and the NPI check read live claims and remittances every day, and the 837P writer writes live Medicare secondary claims, each imported into the API, never copied. The rest, the 837I and 837D writers, the claim readers and edits, the payer directory, the eligibility and denial explainers, claim tracking, enrollment, the sandbox payers and your account, is Payerworks’ own code, written for this API.
- What is kept, and for how long: A claim, a file or a remittance you send is answered and forgotten: never stored, never logged. A batch job is the one exception you ask for by name: it keeps your file until the job finishes and its result for 24 hours after, then deletes both. What is kept is a count of your key’s calls; your webhook’s address and signing secret; each webhook event queued for you, for 30 days, which holds the sandbox’s invented answer and, from what you sent, only your claim references and your file’s control numbers, or for an enrollment event only its ids, statuses and words (up to 2,000 events a UTC day); and for 24 hours a fingerprint of each request sent with an Idempotency-Key, never the request itself. Your webhook destinations (each one’s name, address, event types and signing secret, and what was posted to it, for as long as its event is kept), the address you set for notices and your keys’ names are kept until you remove them. Enrollment is the one part of the API that keeps what you send: the providers and enrollment requests you create (names, NPIs, tax ids, contacts and notes) and the PDFs you upload for a task, because a request lives for weeks and Payerworks people work it. They are for a practice’s business facts; never put a patient’s information in them. A test key’s providers and requests expire 30 days after their last change, and its PDFs 30 days after each was uploaded, or about a day after you delete one; a PDF uploaded but never confirmed goes after a day, whatever the key. A live key’s are kept until you delete them, and the copy of a deleted live PDF for 30 days more. Apart from that, our backups hold every PDF that was there each night, a test key’s included, for 7 days (35 for a night before 12/03/2026), and each Sunday’s for 14 days (180 for a Sunday before 12/06/2026, a year for one before 11/22/2026).
- Errors you can act on: Every refusal comes back with a stable code, the path of the field, and a sentence a person can read. A rejection from a payer comes back the same way.
- Honest about sending: The API builds, checks and reads every file, and the sandbox payers answer your test files end to end. It does not yet send a file to a real payer: transmission opens one payer at a time as Payerworks’ own routes go live, and until then you send on the connection you already have.
- Test it without a call: A test key comes from this page and the sandbox payer answers it right away, with no meeting and no contract. A live key needs a signed business associate agreement first, because a live file carries real patients.
- Answers pushed to you: Set a webhook and every answer the 837P claims sandbox makes, and every change to an enrollment request, is posted to your server as it is made, signed under the Standard Webhooks specification, so any of its libraries checks it. An event your server did not take is tried again, and every event can be listed and sent again for 30 days. Up to ten more webhook destinations, each with its own secret and its own event types, are each tried again on their own schedule for more than three days.
Keys and limits
- Send your key on every call as
Authorization: Bearer <key>. - A test key (pw_test_…) is yours from the form on this page, for invented data only. It writes test interchanges and runs the sandbox payer, and nothing sent with it reaches a payer.
- A live key (pw_live_…) writes production files. Payerworks issues it once a business associate agreement is signed; ask from the form at the foot of the page.
- Each key has a rate in calls a minute: a test key from this page has 60, and a key Payerworks issues has 120 unless another rate is agreed. The rate is counted in a window that resets at the start of each UTC minute. Every answer to a route called with a valid key, an error included, carries x-ratelimit-limit, x-ratelimit-remaining and x-ratelimit-reset (the seconds until the window resets), and the same figures in the RateLimit and RateLimit-Policy fields of the IETF draft. Past the limit the answer is 429 with retry-after. An answer given before a key is read carries none of them: a missing or invalid key, an unknown path (404), a method the route does not answer (405), a path that does not decode (400), or GET /v1/health, which takes no key.
- A call the API turns away before any work is done is counted as refused, apart from your calls: over the rate, a body that is not JSON or is too large, a query it cannot read, or an Idempotency-Key it cannot read, already used for another request or still running.
- A revoked key stops working within a minute.
- An account is the keys one key started. POST /v1/keys makes a named key of your key’s own mode and rate, shown once, with an expiry if you want one (1 to 365 days); a key never outlives the key that made it: its expiry is the sooner of expires_in_days and the making key’s own, and the making key’s when none is asked. An account holds 3 test keys or 25 live ones that are not revoked. Every key of an account may list its keys, and make, rotate and revoke them unless the account’s organization chose that only its signed-in members do.
- POST /v1/keys/{id}/rotate gives a key a new secret under the same key id, so its webhooks, events, usage and enrollments carry on. The old secret is still accepted for overlap_hours (24 by default, up to 720) and stops at once if the key is revoked; a second rotation ends the first one’s overlap. Two rotations at once: the first finishes, and the other answers 409 key_rotation_conflict and makes nothing.
Every route is under /v1. The base URL is shown with your key. The whole contract, machine-readable, is /openapi.json.
Safe to retry
Send an Idempotency-Key header with any POST, and with the webhook PUT, and a retry gets the first answer instead of a second run.
- Use a new key for each new request: a UUID is a good one. A key is remembered for 24 hours.
- A retry with the same key and the same request gets the first answer again, with the header idempotent-replayed: true. What the first request did is not done a second time, and the sandbox’s webhook events keep their ids, so your server can ignore one it already handled.
- If the first answer said its webhook events could not be recorded or queued, and to retry, the retry with the same key does that step instead of repeating the refusal.
- The same key with a different request is refused with 422. While the first request is still running, a retry is refused with 409 and retry-after.
- An answer that failed on our side (a 5xx) is not remembered, so a retry runs the request again.
- Payerworks keeps a fingerprint of the request and the moment it ran, so it can answer the same way again. It never keeps the request or the answer.
key=$(uuidgen) # one new key per request; reuse it only to retry that request
curl "$PAYERWORKS_BASE_URL/v1/sandbox/claims" \
-H "Authorization: Bearer $PAYERWORKS_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $key" \
-d @claims.jsonimport { randomUUID } from "node:crypto";
const key = randomUUID(); // one per request; the same key on every retry of it
for (let attempt = 0; attempt < 3; attempt++) {
const res = await fetch(`${process.env.PAYERWORKS_BASE_URL}/v1/sandbox/claims`, {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PAYERWORKS_API_KEY}`, "Content-Type": "application/json", "Idempotency-Key": key },
body: JSON.stringify({ claims }),
});
if (res.status < 500 && res.status !== 409 && res.status !== 429) {
console.log(res.headers.get("idempotent-replayed") === "true" ? "the first answer, again" : "answered");
break;
}
await new Promise((r) => setTimeout(r, 1000 * Number(res.headers.get("retry-after") || 1)));
}import os, time, uuid, requests
key = str(uuid.uuid4()) # one per request; the same key on every retry of it
for attempt in range(3):
res = requests.post(
f"{os.environ['PAYERWORKS_BASE_URL']}/v1/sandbox/claims",
headers={"Authorization": f"Bearer {os.environ['PAYERWORKS_API_KEY']}", "Idempotency-Key": key},
json={"claims": claims},
)
if res.status_code < 500 and res.status_code not in (409, 429):
break
time.sleep(int(res.headers.get("retry-after", "1")))Client libraries and an MCP server
Three files, generated from the same route list as this page and openapi.json, so every route here is a method there. Each is plain source with no dependencies: download it, read it, and keep it in your own repository.
- /sdk/payerworks.mjs: JavaScript. An ES module for Node 18 or later, on your server: one method per route, typed in JSDoc, and uploadDocument for an enrollment task’s PDF. Your key is a bearer key, so never put it in browser code.
- /sdk/payerworks.py: Python. For Python 3.9 or later, the standard library only: one method per route.
- /sdk/payerworks-mcp.mjs: MCP server. For an AI agent: run it with node over stdio, and each route that answers a question is a tool, with the reads of your account and your enrollment requests, except the routes that answer with a PDF, the two that read a picture with a model, and the enrollment export. Setting, removing or testing your webhook, sending an event again, and every change to a provider, an enrollment request, a task, a document, a key or a destination stay with you. One tool writes to your account: a sandbox claims run records its events and posts them to your webhook, when one is set.
- The JavaScript and Python clients each send an Idempotency-Key on every POST and PUT, and retry a 429, a 503 or a 409 idempotency_in_flight at most twice, after the wait retry-after names, with the same key. A refusal is a PayerworksError carrying the status, the code, the sentence and the request id.
- The two clients also each check a webhook’s signature, in the Standard Webhooks headers or the Payerworks-Signature header, in constant time.
- The MCP server makes its calls the same way: an Idempotency-Key on every POST its tools send, and the same retries with the same key, waiting at most 30 seconds. A refusal reaches the model as a tool error carrying the status, the code, the sentence and the request id.
- Both clients can keep your own request log: requestLog: true (request_log=True in Python) keeps the last 1,000 attempts in your process, a number keeps that many, and requestLogFile (request_log_file) appends one JSON line an attempt to a file of yours. Each entry is the method, the path, the status, the request id, the time it took and the Idempotency-Key, never a body, a query or a header. Payerworks keeps no such record of your calls.
- Each of the three calls only the base URL you give it, never follows a redirect, and sends nothing anywhere else. The one exception is the JavaScript client’s uploadDocument, which posts your PDF, without your key, to the https upload address the API answered for it. Download again when this page lists a new route: each file names the build it was made from.
Add the MCP server to your AI client’s configuration:
// Download /sdk/payerworks.mjs from this site into your project.
import { Payerworks, PayerworksError } from "./payerworks.mjs";
const pw = new Payerworks({ apiKey: process.env.PAYERWORKS_API_KEY, baseUrl: process.env.PAYERWORKS_BASE_URL });
try {
const { valid, claims } = await pw.postClaimsValidate({ claim });
const page = await pw.getEvents({ query: { limit: 10 } });
} catch (e) {
if (e instanceof PayerworksError) console.log(e.status, e.code, e.message, e.requestId);
}# Download /sdk/payerworks.py from this site into your project.
from payerworks import Payerworks, PayerworksError
pw = Payerworks() # PAYERWORKS_API_KEY and PAYERWORKS_BASE_URL from the environment
try:
checked = pw.post_claims_validate({"claim": claim})
page = pw.get_events(query={"limit": 10})
except PayerworksError as e:
print(e.status, e.code, e.request_id){
"mcpServers": {
"payerworks": {
"command": "node",
"args": ["/absolute/path/to/payerworks-mcp.mjs"],
"env": { "PAYERWORKS_API_KEY": "pw_test_...", "PAYERWORKS_BASE_URL": "<the address shown with your key>" }
}
}
}Example
keys.mjs runs every step below against the API with a test key. It needs payerworks.mjs and sample-data.mjs beside it.
// Payerworks example: keys and your account. Docs: https://payerworks.com/docs/keys
//
// Run it with Node 18 or later, with the JavaScript client (https://payerworks.com/sdk/payerworks.mjs)
// and sample-data.mjs beside this file:
// PAYERWORKS_API_KEY=pw_test_... PAYERWORKS_BASE_URL=<the base URL shown with your key> node keys.mjs
// A test key and invented data only. Payerworks sends nothing to a payer: every file it writes is yours.
import { pathToFileURL } from 'node:url';
import { Payerworks, PayerworksError } from './payerworks.mjs';
import { refusalOf } from './sample-data.mjs';
/** @param {Payerworks} pw */
export async function run(pw) {
// 1. Health needs no key, and says the API transmits nothing.
const health = await pw.getHealth();
// 2. Your key's rate a minute, and its calls this month to date by UTC day.
const account = await pw.getAccount();
// 3. A named key for one job, shown once, then revoked. Every key of an account may manage its keys,
// unless the account's organization chose that only its signed-in members do.
const made = await pw.postKeys({ name: 'Example job', expires_in_days: 1 });
const revoked = await pw.deleteKeysById(made.key_id);
// 4. The account's audit log: who made and revoked that key, when, and through which door, newest first.
const log = await pw.getAuditLog({ query: { limit: 2 } });
// 5. The failure path: a key id this account never had.
const refused = await refusalOf(() => pw.deleteKeysById('pwk_0000000000000000'), { PayerworksError });
return {
transmits: health.transmits,
mode: account.mode,
rpm: account.rpm,
made: { key_id: made.key_id.startsWith('pwk_'), shown_once: typeof made.key === 'string' },
revoked: Boolean(revoked),
audit: log.data.map((e) => ({ type: e.type, by: e.actor.type, door: e.door })),
refused,
};
}
// Run as a script: node <this file>, with PAYERWORKS_API_KEY and PAYERWORKS_BASE_URL set.
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
console.log(JSON.stringify(await run(new Payerworks()), null, 2));
}
{
"transmits": false,
"mode": "test",
"rpm": 600,
"made": {
"key_id": true,
"shown_once": true
},
"revoked": true,
"audit": [
{
"type": "key.revoked",
"by": "key",
"door": "api"
},
{
"type": "key.created",
"by": "key",
"door": "api"
}
],
"refused": {
"status": 404,
"code": "key_not_found",
"request_id": "req_6"
}
}A free test key lets you try the API’s calls with invented data only. Payerworks sends nothing to any payer yet.
Get a test key