Overview
All Parchment Health API endpoints follow a consistent response structure to ensure predictability and ease of integration. Our responses comply with industry standards including RFC 7807 for error handling.Response Structure
Success Response Format
All successful API responses follow this structure:Error Response Format (RFC 7807)
All error responses follow the RFC 7807 Problem Details standard:HTTP Status Codes
Success Codes
Error Codes
Response Fields
Core Fields
Optional Fields
Pagination Object Fields
Error Object Fields
Error Types
Standard Error Types
Response Examples
Create Patient Success (201)
Get Patient Success (200)
List Patients Success (200)
Validation Error (422)
Unauthorized Error (401)
Partner Patient ID Conflict (409)
Patient Not Found (404)
Internal Server Error (500)
Request Tracing
Every response includes a uniquerequestId that can be used for:
- Debugging: Reference this ID when reporting issues
- Logging: Correlate requests across different systems
- Monitoring: Track request flow through the system
req_1705312200000_abc123
API Versioning
The API version information is tracked internally for compatibility purposes, allowing for:- Backward Compatibility: Maintain support for older integrations
- Feature Detection: Identify available features based on version
- Migration Planning: Plan upgrades to newer API versions
Pagination Usage
When working with paginated endpoints, use thelastKey field to navigate through pages:
Making Paginated Requests
Pagination Best Practices
- Always check
hasNextbefore requesting the next page - Use
lastKeyfor cursor-based pagination when available - Fall back to
offsetfor offset-based pagination when needed - URL encode
lastKeyvalues when using as query parameters - Handle
nulllastKey as indication of no more pages
Best Practices
Error Handling
- Always check the
successfield to determine if the request succeeded - Use
statusCodefor programmatic handling of different scenarios - Display
error.detailto users for human-readable error messages - Log
requestIdfor debugging and support requests - Handle validation errors by checking the
error.validationarray
Integration Tips
- Store
requestIdin your logs for easier debugging - Implement retry logic for 5xx errors with exponential backoff
- Cache successful responses when appropriate to reduce API calls
- Monitor response times for performance tracking
- Validate API version compatibility when integrating
Migration Guide
From Legacy Responses
If you’re migrating from the legacy response format:- Update success checks: Use
response.successinstead of checkingstatusCode < 400 - Extract data: Access response data from
response.datainstead of the root - Handle errors: Use
response.errorobject instead ofresponse.message - Add request tracing: Store
response.requestIdfor debugging

