GraphQL API Reference
Welcome to the comprehensive Prospyr GraphQL API reference. This documentation is automatically generated from our GraphQL schema.
Overview
The Prospyr API uses GraphQL, a query language that allows you to request exactly the data you need. All API access is through a single endpoint:
https://prod.prospyrmedapi.com/v1/graphql
Key Concepts
Operations
GraphQL supports three types of operations:
- Queries - Fetch data from the API
- Mutations - Create, update, or delete data
- Subscriptions - Real-time updates via WebSocket
Type System
Our API uses a strongly-typed schema:
- Object Types - Core data models (Patient, Appointment, Provider, etc.)
- Input Types - Types used for mutations and filtering
- Enums - Predefined sets of values
- Scalars - Basic data types (String, Int, Date, etc.)
Common Patterns
Filtering
Most queries support filtering through where
arguments:
query FilteredPatients {
patient(where: {
age: { _gte: 18 },
city: { _eq: "New York" }
}) {
id
firstName
lastName
}
}
Pagination
Use limit
and offset
for pagination:
query PaginatedResults {
appointment(
limit: 20,
offset: 40,
order_by: { startTime: desc }
) {
id
startTime
}
}
Relationships
Navigate relationships in a single query:
query PatientWithAppointments {
patient_by_pk(id: 123) {
id
firstName
appointments {
id
startTime
provider {
firstName
lastName
}
}
}
}
Aggregations
Get counts and other aggregates:
query CountPatients {
patient_aggregate(where: { isActive: { _eq: true } }) {
aggregate {
count
avg {
age
}
}
}
}
Best Practices
- Request Only What You Need - GraphQL allows you to specify exact fields
- Use Fragments - Reuse common field selections across queries
- Batch Operations - Combine multiple queries in a single request
- Handle Errors - Check the
errors
array in responses - Use Variables - Never hardcode values in queries
Schema Exploration
You can explore the schema interactively using:
- GraphQL Playground - Available at the API endpoint
- Introspection Queries - Query the schema itself
- Postman Collection - Pre-built queries and mutations
Getting Help
- For authentication setup, see Authentication
- For example requests, see Sample Requests
- For support, contact gsupport@prospyrmed.com