{"openapi":"3.1.0","jsonSchemaDialect":"https://json-schema.org/draft/2020-12/schema","info":{"title":"Medsender API","version":"2","description":"Machine-readable representation of the existing Medsender developer documentation. Use Bearer API keys and the established direct API server below."},"externalDocs":{"description":"API version and access guidance","url":"https://developer.medsender.com/docs/versioning"},"servers":[{"url":"https://api.medsender.com/api/v2"}],"tags":[{"name":"Sent Faxes"},{"name":"Received Faxes"},{"name":"Fax Numbers"},{"name":"Clients"},{"name":"Secure Links"},{"name":"AI Documents"}],"paths":{"/sent_faxes":{"get":{"operationId":"listSentFaxes","tags":["Sent Faxes"],"summary":"List sent faxes","description":"Returns a paginated list of sent faxes for the authenticated account.","security":[{"bearerAuth":[]}],"parameters":[{"name":"page","in":"query","description":"Page number to return.","schema":{"type":"integer"}},{"name":"page_size","in":"query","description":"Number of records per page.","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"from_number","in":"query","description":"Filter by the Medsender fax number that sent the fax.","schema":{"type":"string"}},{"name":"to_number","in":"query","description":"Filter by destination fax number.","schema":{"type":"string"}},{"name":"patient_name","in":"query","description":"Filter by patient name.","schema":{"type":"string"}},{"name":"patient_dob","in":"query","description":"Filter by patient date of birth.","schema":{"type":"string"}},{"name":"sender_name","in":"query","description":"Filter by sender name.","schema":{"type":"string"}},{"name":"recipient_name","in":"query","description":"Filter by recipient name.","schema":{"type":"string"}},{"name":"date_start","in":"query","description":"Start of the documented date range filter.","schema":{"type":"string"}},{"name":"date_end","in":"query","description":"End of the documented date range filter.","schema":{"type":"string"}},{"name":"is_test","in":"query","description":"Filter test or live records.","schema":{"type":"boolean"}},{"name":"sort","in":"query","description":"Field used to sort results.","schema":{"type":"string"}},{"name":"sort_dir","in":"query","description":"Sort direction.","schema":{"type":"string"}}],"responses":{"200":{"description":"Sent faxes and pagination metadata.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SentFaxList"}}}},"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"post":{"operationId":"createSentFax","tags":["Sent Faxes"],"summary":"Send a fax","description":"Uploads a PDF or TIFF and queues a fax for delivery.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/SentFaxCreateRequest"}}}},"responses":{"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"2XX":{"description":"The fax was accepted for delivery.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FaxQueued"}}}}}}},"/sent_faxes/{send_token}":{"get":{"operationId":"getSentFax","tags":["Sent Faxes"],"summary":"Retrieve a sent fax","description":"Retrieves the documented details and delivery status for one sent fax.","security":[{"bearerAuth":[]}],"parameters":[{"name":"send_token","in":"path","description":"The fax send token returned by the API.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The requested sent fax.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SentFax"}}}},"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"The requested resource was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/received_faxes":{"get":{"operationId":"listReceivedFaxes","tags":["Received Faxes"],"summary":"List received faxes","description":"Returns a paginated list of received faxes for the authenticated account.","security":[{"bearerAuth":[]}],"parameters":[{"name":"page","in":"query","description":"Page number to return.","schema":{"type":"integer"}},{"name":"page_size","in":"query","description":"Number of records per page.","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"from_number","in":"query","description":"Filter by sending fax number.","schema":{"type":"string"}},{"name":"to_number","in":"query","description":"Filter by the Medsender fax number that received the fax.","schema":{"type":"string"}},{"name":"caller_name","in":"query","description":"Filter by caller ID name.","schema":{"type":"string"}},{"name":"date_start","in":"query","description":"Start of the documented date range filter.","schema":{"type":"string"}},{"name":"date_end","in":"query","description":"End of the documented date range filter.","schema":{"type":"string"}},{"name":"fax_status","in":"query","description":"Filter by reception status.","schema":{"type":"string"}},{"name":"is_test","in":"query","description":"Filter test or live records.","schema":{"type":"boolean"}},{"name":"client","in":"query","description":"Filter by client identifier.","schema":{"type":"string"}},{"name":"callback_status","in":"query","description":"Filter by callback delivery status.","schema":{"type":"string"}}],"responses":{"200":{"description":"Received faxes and pagination metadata.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceivedFaxList"}}}},"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/received_faxes/{send_token}":{"get":{"operationId":"getReceivedFax","tags":["Received Faxes"],"summary":"Retrieve a received fax","description":"Retrieves the documented details for one received fax.","security":[{"bearerAuth":[]}],"parameters":[{"name":"send_token","in":"path","description":"The fax send token returned by the API.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The requested received fax.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceivedFax"}}}},"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"The requested resource was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/received_faxes/test_receive":{"post":{"operationId":"testReceiveFax","tags":["Received Faxes"],"summary":"Simulate a received fax","description":"Uploads a PDF or TIFF to simulate an inbound fax in the test workflow.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/ReceivedFaxTestRequest"}}}},"responses":{"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"2XX":{"description":"The test fax was accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}}}}},"/received_faxes/{send_token}/forward_as_fax":{"post":{"operationId":"forwardReceivedFax","tags":["Received Faxes"],"summary":"Forward a received fax","description":"Forwards an existing received fax to another fax number.","security":[{"bearerAuth":[]}],"parameters":[{"name":"send_token","in":"path","description":"The fax send token returned by the API.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/ForwardFaxRequest"}}}},"responses":{"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"The requested resource was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"2XX":{"description":"The forwarded fax was accepted for delivery.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FaxQueued"}}}}}}},"/fax_numbers":{"get":{"operationId":"listFaxNumbers","tags":["Fax Numbers"],"summary":"List fax numbers","description":"Returns all fax numbers provisioned for the authenticated account.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The account fax numbers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FaxNumberList"}}}},"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"post":{"operationId":"createFaxNumber","tags":["Fax Numbers"],"summary":"Provision a fax number","description":"Provisions a fax number in the requested US area code.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FaxNumberCreateRequest"}}}},"responses":{"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"422":{"description":"The account has reached its fax-number limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FaxNumberQuotaError"}}}},"2XX":{"description":"The provisioned fax number.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FaxNumberEnvelope"}}}}}}},"/fax_numbers/{slug}":{"get":{"operationId":"getFaxNumber","tags":["Fax Numbers"],"summary":"Retrieve a fax number","description":"Retrieves one fax number by its documented identifier.","security":[{"bearerAuth":[]}],"parameters":[{"name":"slug","in":"path","description":"The documented fax-number identifier.","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The requested fax number.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FaxNumberEnvelope"}}}},"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"The requested resource was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"patch":{"operationId":"updateFaxNumber","tags":["Fax Numbers"],"summary":"Update a fax number","description":"Updates the callback URL or assigned client for an existing fax number.","security":[{"bearerAuth":[]}],"parameters":[{"name":"slug","in":"path","description":"The documented fax-number identifier.","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FaxNumberUpdateRequest"}}}},"responses":{"200":{"description":"The updated fax number.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FaxNumberEnvelope"}}}},"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"The requested resource was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/clients":{"get":{"operationId":"listClients","tags":["Clients"],"summary":"List clients","description":"Returns all logical clients configured for the authenticated account.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The account clients.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientList"}}}},"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"post":{"operationId":"createClient","tags":["Clients"],"summary":"Create a client","description":"Creates a logical client and optionally assigns a fax number.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientCreateRequest"}}}},"responses":{"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"2XX":{"description":"The created client.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientEnvelope"}}}}}}},"/clients/{client_id}":{"get":{"operationId":"getClient","tags":["Clients"],"summary":"Retrieve a client","description":"Retrieves one logical client and its assigned fax numbers.","security":[{"bearerAuth":[]}],"parameters":[{"name":"client_id","in":"path","description":"The client identifier.","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The requested client.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientEnvelope"}}}},"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"The requested resource was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"patch":{"operationId":"updateClient","tags":["Clients"],"summary":"Update a client","description":"Updates an existing logical client.","security":[{"bearerAuth":[]}],"parameters":[{"name":"client_id","in":"path","description":"The client identifier.","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientUpdateRequest"}}}},"responses":{"200":{"description":"The updated client.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientEnvelope"}}}},"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"The requested resource was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/emails":{"post":{"operationId":"createEmail","tags":["Secure Links"],"summary":"Send a secure email link","description":"Uploads a document and sends its recipient a secure, time-limited email link.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/EmailCreateRequest"}}}},"responses":{"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"2XX":{"description":"The secure-link email was accepted for delivery.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailQueued"}}}}}}},"/emails/{email_id}":{"get":{"operationId":"getEmail","tags":["Secure Links"],"summary":"Retrieve a secure-link email","description":"Retrieves the documented status and secure-link fields for one email.","security":[{"bearerAuth":[]}],"parameters":[{"name":"email_id","in":"path","description":"The email identifier returned when the secure link was created.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The requested secure-link email.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Email"}}}},"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"The requested resource was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/ai_documents":{"get":{"operationId":"listAiDocuments","tags":["AI Documents"],"summary":"List AI documents","description":"Lists AI document-processing records for the authenticated account.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"AI document results.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiDocumentList"}}}},"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"post":{"operationId":"createAiDocument","tags":["AI Documents"],"summary":"Run AI on a document","description":"Uploads a PDF document up to 50 MB (52,428,800 bytes) for asynchronous AI extraction and classification.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/AiDocumentCreateRequest"}}}},"responses":{"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"2XX":{"description":"AI processing was initiated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiDocumentQueued"}}}}}}},"/ai_documents/{ai_token}":{"get":{"operationId":"getAiDocument","tags":["AI Documents"],"summary":"Retrieve an AI document","description":"Retrieves extracted fields and classification for one AI document token.","security":[{"bearerAuth":[]}],"parameters":[{"name":"ai_token","in":"path","description":"The AI document token returned when processing was started.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The requested AI document result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiDocumentResponse"}}}},"400":{"description":"The request was invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"The Bearer API key was missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Medsender API key. Test keys start with sk_test_; live keys start with sk_live_."}},"schemas":{"ErrorEnvelope":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["status","title","detail"],"properties":{"status":{"type":"integer"},"title":{"type":"string"},"detail":{"anyOf":[{"type":"string"},{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}]}}}}},"PaginationMeta":{"type":"object","required":["totalCount","totalPages","perPage","page"],"properties":{"totalCount":{"type":"integer","minimum":0},"totalPages":{"type":"integer","minimum":0},"perPage":{"type":"integer","minimum":1},"page":{"type":"integer","minimum":1}}},"FaxNumberQuotaError":{"type":"object","required":["error","upgradePath"],"properties":{"error":{"type":"string"},"upgradePath":{"type":"string","description":"Relative path to upgrade the account."}}},"FaxErrorDetails":{"type":["object","null"],"required":["errorMessage"],"properties":{"errorMessage":{"type":["string","null"]}}},"FaxNumberClient":{"type":["object","null"],"required":["clientId","name"],"properties":{"clientId":{"type":"string","format":"uuid"},"name":{"type":"string"}}},"ClientFaxNumber":{"type":"object","required":["id","number","callbackUrl","uri"],"properties":{"id":{"type":"string","format":"uuid"},"number":{"type":"string","description":"Fax number in E.164 format.","pattern":"^\\+[1-9]\\d{1,14}$"},"callbackUrl":{"anyOf":[{"type":["string","null"],"format":"uri"},{"type":"string","const":""}]},"uri":{"type":"string","format":"uri"}}},"SecureLinkErrorDetails":{"type":"object","required":["errorCode","errorDetails"],"properties":{"errorCode":{"type":["string","null"]},"errorDetails":{"type":["string","null"]}}},"SentFax":{"type":"object","required":["sendToken","fromNumber","toNumber","sentStatus","isTest"],"properties":{"sendToken":{"type":"string"},"fromNumber":{"type":"string","description":"Fax number in E.164 format.","pattern":"^\\+[1-9]\\d{1,14}$"},"toNumber":{"type":"string","description":"Fax number in E.164 format.","pattern":"^\\+[1-9]\\d{1,14}$"},"sentStatus":{"type":"string","enum":["queued","inprogress","success","failure"]},"sentAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"numPages":{"type":["integer","null"],"minimum":0},"errorDetails":{"$ref":"#/components/schemas/FaxErrorDetails"},"isTest":{"type":["boolean","null"],"description":"Null for forwarded faxes when no test flag was set."},"patientName":{"type":["string","null"]},"patientDob":{"type":["string","null"],"format":"date"},"senderName":{"type":["string","null"]},"recipientName":{"type":["string","null"]},"note":{"type":["string","null"]},"recordStatus":{"type":"string","enum":["activated","archived","revoked"]},"documentType":{"type":"string","enum":["both","document_only","access_code_sheet_only"]},"expiry":{"type":["string","null"],"format":"date-time"},"viewCount":{"type":"integer","minimum":0},"secureLink":{"type":["string","null"],"format":"uri"}}},"SentFaxList":{"type":"object","required":["sentFaxes","meta"],"properties":{"sentFaxes":{"type":"array","items":{"$ref":"#/components/schemas/SentFax"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}}},"SentFaxCreateRequest":{"type":"object","required":["file","from_number","to_number"],"properties":{"file":{"type":"string","format":"binary","description":"PDF or TIFF file."},"from_number":{"type":"string","description":"Fax number in E.164 format.","pattern":"^\\+[1-9]\\d{1,14}$"},"to_number":{"type":"string","description":"Fax number in E.164 format.","pattern":"^\\+[1-9]\\d{1,14}$"},"callback_url":{"type":"string","format":"uri"},"patient_name":{"type":"string"},"patient_dob":{"type":"string","format":"date"},"sender_name":{"type":"string"},"recipient_name":{"type":"string"},"note":{"type":"string"},"document_type":{"type":"string","enum":["both","document_only","access_code_sheet_only"],"default":"both"}}},"FaxQueued":{"type":"object","required":["message","faxId"],"properties":{"message":{"type":"string"},"faxId":{"type":"string"}}},"ReceivedFax":{"type":"object","required":["sendToken","fromNumber","toNumber","faxStatus","isTest"],"properties":{"sendToken":{"type":"string"},"fromNumber":{"type":"string","description":"Fax number in E.164 format.","pattern":"^\\+[1-9]\\d{1,14}$"},"toNumber":{"type":"string","description":"Fax number in E.164 format.","pattern":"^\\+[1-9]\\d{1,14}$"},"callerName":{"type":["string","null"]},"faxStatus":{"type":"string","enum":["success","failure"]},"sentAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"numPages":{"type":["integer","null"],"minimum":0},"isTest":{"type":"boolean"},"errorDetails":{"$ref":"#/components/schemas/FaxErrorDetails"},"callbackStatus":{"type":["string","null"],"enum":["success","failed","pending",null]},"client":{"type":["string","null"]},"documentClassification":{"type":["string","null"]},"secondaryCategory":{"type":["string","null"]},"patientName":{"type":["string","null"]},"patientFirstName":{"type":["string","null"]},"patientMiddleName":{"type":["string","null"]},"patientLastName":{"type":["string","null"]},"patientDob":{"type":["string","null"],"format":"date"},"insuranceMemberId":{"type":["string","null"]},"referenceNumber":{"type":["string","null"]},"authorizationNumber":{"type":["string","null"]},"codes":{"type":["string","null"],"description":"Extracted codes as stored text, or null when AI extraction is absent. The text is not guaranteed to be JSON."},"authDateRangeStart":{"type":["string","null"],"format":"date"},"authDateRangeEnd":{"type":["string","null"],"format":"date"},"denialReason":{"type":["string","null"]},"secureLink":{"type":["string","null"],"format":"uri"}}},"ReceivedFaxList":{"type":"object","required":["receivedFaxes","meta"],"properties":{"receivedFaxes":{"type":"array","items":{"$ref":"#/components/schemas/ReceivedFax"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}}},"ReceivedFaxTestRequest":{"type":"object","required":["file","to_number","from_number"],"properties":{"file":{"type":"string","format":"binary","description":"PDF or TIFF file."},"to_number":{"type":"string","description":"Fax number in E.164 format.","pattern":"^\\+[1-9]\\d{1,14}$"},"from_number":{"type":"string","description":"Fax number in E.164 format.","pattern":"^\\+[1-9]\\d{1,14}$"}}},"ForwardFaxRequest":{"type":"object","required":["to_number"],"properties":{"to_number":{"type":"string","description":"Fax number in E.164 format.","pattern":"^\\+[1-9]\\d{1,14}$"}}},"MessageResponse":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}},"FaxNumber":{"type":"object","required":["id","number","callbackUrl","createdAt","client","uri"],"properties":{"id":{"type":"string","format":"uuid"},"number":{"type":"string","description":"Fax number in E.164 format.","pattern":"^\\+[1-9]\\d{1,14}$"},"callbackUrl":{"anyOf":[{"type":["string","null"],"format":"uri"},{"type":"string","const":""}]},"createdAt":{"type":"string","format":"date-time"},"client":{"$ref":"#/components/schemas/FaxNumberClient"},"uri":{"type":"string","format":"uri"}}},"FaxNumberList":{"type":"object","required":["faxNumbers"],"properties":{"faxNumbers":{"type":"array","items":{"$ref":"#/components/schemas/FaxNumber"}}}},"FaxNumberEnvelope":{"type":"object","required":["faxNumber"],"properties":{"faxNumber":{"$ref":"#/components/schemas/FaxNumber"}}},"FaxNumberCreateRequest":{"type":"object","required":["fax_number"],"properties":{"fax_number":{"type":"object","required":["area_code"],"properties":{"area_code":{"type":"string","pattern":"^\\d{3}$"},"callback_url":{"type":["string","null"],"format":"uri"},"client_id":{"type":"string","format":"uuid"}}}}},"FaxNumberUpdateRequest":{"type":"object","required":["fax_number"],"properties":{"fax_number":{"type":"object","minProperties":1,"additionalProperties":false,"properties":{"callback_url":{"type":["string","null"],"format":"uri"},"client_id":{"type":["string","null"],"format":"uuid"}}}}},"Client":{"type":"object","required":["clientId","name","faxNumbers"],"properties":{"clientId":{"type":"string","format":"uuid"},"name":{"type":"string"},"faxNumbers":{"type":"array","items":{"$ref":"#/components/schemas/ClientFaxNumber"}}}},"ClientList":{"type":"object","required":["clients"],"properties":{"clients":{"type":"array","items":{"$ref":"#/components/schemas/Client"}}}},"ClientEnvelope":{"type":"object","required":["client"],"properties":{"client":{"$ref":"#/components/schemas/Client"}}},"ClientCreateRequest":{"type":"object","required":["client"],"properties":{"client":{"type":"object","required":["name"],"additionalProperties":false,"properties":{"name":{"type":"string"},"fax_number_id":{"type":["string","null"],"format":"uuid"}}}}},"ClientUpdateRequest":{"type":"object","required":["client"],"properties":{"client":{"type":"object","required":["name"],"additionalProperties":false,"properties":{"name":{"type":"string"}}}}},"EmailCreateRequest":{"type":"object","required":["file","recipient_email","expire_after"],"properties":{"file":{"type":"string","format":"binary","description":"PDF or TIFF document."},"recipient_email":{"type":"string","format":"email"},"recipient_name":{"type":"string"},"sender_name":{"type":"string"},"reply_to_email":{"type":"string","format":"email"},"subject":{"type":"string"},"note":{"type":"string"},"patient_name":{"type":"string"},"patient_dob":{"type":"string","format":"date"},"expire_after":{"type":"integer","minimum":1,"maximum":180},"callback_url":{"type":"string","format":"uri"}}},"EmailQueued":{"type":"object","required":["message","emailId"],"properties":{"message":{"type":"string"},"emailId":{"type":"string"}}},"Email":{"type":"object","required":["emailId","recipientEmail","emailStatus","recordStatus","isTest","errorDetails"],"properties":{"emailId":{"type":"string"},"recipientEmail":{"type":"string","format":"email"},"recipientName":{"type":["string","null"]},"senderName":{"type":["string","null"]},"replyToEmail":{"anyOf":[{"type":["string","null"],"format":"email"},{"type":"string","const":""}]},"subject":{"type":["string","null"]},"note":{"type":["string","null"]},"patientName":{"type":["string","null"]},"patientDob":{"type":["string","null"],"format":"date"},"recordStatus":{"type":["string","null"],"enum":["activated","archived","revoked",null]},"emailStatus":{"type":"string","enum":["queued","inprogress","success","failure"]},"secureLink":{"type":["string","null"],"format":"uri"},"expiry":{"type":["string","null"],"format":"date-time"},"sentAt":{"type":["string","null"],"format":"date-time"},"lastViewedAt":{"type":["string","null"],"format":"date-time"},"isTest":{"type":"boolean"},"errorDetails":{"$ref":"#/components/schemas/SecureLinkErrorDetails"}}},"AiDocumentCreateRequest":{"type":"object","required":["file","callback_url"],"properties":{"file":{"type":"string","format":"binary","description":"PDF document only, up to 50 MB (52,428,800 bytes)."},"callback_url":{"type":"string","format":"uri"}}},"AiDocumentQueued":{"type":"object","required":["message","aiToken"],"properties":{"message":{"type":"string"},"aiToken":{"type":"string"}}},"AiResult":{"type":"object","required":["aiToken"],"properties":{"aiToken":{"type":"string"},"patientName":{"type":["string","null"]},"patientFirstName":{"type":["string","null"]},"patientMiddleName":{"type":["string","null"]},"patientLastName":{"type":["string","null"]},"patientDob":{"type":["string","null"],"format":"date"},"patientPhoneNumber":{"type":["string","null"]},"patientGender":{"type":["string","null"]},"patientAddress":{"type":["string","null"]},"documentClassification":{"type":["string","null"]},"documentSummary":{"type":["string","null"]},"insurancePlanName":{"type":["string","null"]},"insurancePayer":{"type":["string","null"]},"insuranceGroupNumber":{"type":["string","null"]},"insuranceMemberId":{"type":["string","null"]},"insuranceSubscriberName":{"type":["string","null"]},"insuranceMemberNames":{"type":["string","null"]},"primaryInsurancePayorBranch":{"type":["string","null"]},"primaryInsurancePayorAddress":{"type":["string","null"]},"primaryInsurancePayorCity":{"type":["string","null"]},"primaryInsurancePayorState":{"type":["string","null"]},"primaryInsurancePayorZipCode":{"type":["string","null"]},"primaryInsurancePayorPhoneNumber":{"type":["string","null"]},"primaryInsurancePayorPoBoxNumber":{"type":["string","null"]},"secondaryInsurancePlanName":{"type":["string","null"]},"secondaryInsurancePayer":{"type":["string","null"]},"secondaryInsuranceGroupNumber":{"type":["string","null"]},"secondaryInsuranceMemberId":{"type":["string","null"]},"secondarySubscriberName":{"type":["string","null"]},"secondaryMemberNames":{"type":["string","null"]},"secondaryInsurancePayorBranch":{"type":["string","null"]},"secondaryInsurancePayorAddress":{"type":["string","null"]},"secondaryInsurancePayorCity":{"type":["string","null"]},"secondaryInsurancePayorState":{"type":["string","null"]},"secondaryInsurancePayorZipCode":{"type":["string","null"]},"secondaryInsurancePayorPhoneNumber":{"type":["string","null"]},"secondaryInsurancePayorPoBoxNumber":{"type":["string","null"]},"icdCodesJson":{"type":["array","object","string","null"],"items":{},"additionalProperties":true},"cptCodesJson":{"type":["array","object","string","null"],"items":{},"additionalProperties":true},"hcpcsCodesJson":{"type":["array","object","string","null"],"items":{},"additionalProperties":true},"completedAt":{"type":["string","null"],"format":"date-time"},"errorDetails":{"type":["string","null"]}}},"AiDocumentResponse":{"type":"object","required":["aiResult"],"properties":{"aiResult":{"$ref":"#/components/schemas/AiResult"}}},"AiDocumentList":{"type":"object","required":["aiDocuments"],"properties":{"aiDocuments":{"type":"array","items":{"$ref":"#/components/schemas/AiDocumentResponse"}}}}}}}