The Osma API lets you integrate your own systems so you can manage all your Osma data automatically.
The API provides a set of endpoints that follow the REST principals. It accepts JSON-formatted request bodies and returns JSON responses as well as standard HTTP response status codes.
In addition to REST endpoints, you can configure webhooks to provide you with real-time updates when certain events are triggered.
Osma’s API can be used in “test mode” and “live mode”. Test mode enables you to test your integration without “polluting” any data in live mode. The API key you use to authenticate a request determines which mode the request will be processed in.
gethttps://api.osma.com/spec/openapi.yamlgethttps://api.osma.com/spec/openapi.json
Osma’s API uses API keys to authenticate requests, that you must pass as the osma-api-key
request header. You can view and manage your API keys in the Osma Dashboard.
There are two kinds of API keys: live mode (prefixed with sk_live_
) and test mode (prefixed with sk_test_
). Most resources contain a boolean field called live_mode
that represents which mode they were created in. Note that some resources, such as users
, are identical in both modes.
curl --request GET \
--url https://api.osma.com/tasks \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv'
To provide a predictable integration experience, the API uses a consistent format for all errors returned. These are returned in the response body in addition to the standard HTTP response status codes.
{
"message": "Invalid request parameter(s)",
"type": "invalid_request_error",
"params": [
{
"param": "date_of_birth",
"message": "date_of_birth must be a valid ISO 8601 date string"
}
]
}
All “list” endpoints, such as GET /members
and GET /tasks
, use cursor-based pagination to return resources. You can set the number of resources per “page” with the limit
query parameter. The maximum of the limit
parameter is 100.
Any valid resource id can be passed to starting_after
and ending_before
query parameters. Typically, when retrieving the “next page”, use starting_after
and set the value to the id
of the last entry of the “page” you’ve already retrieved. When retrieving the previous page, use the ending_before
query parameter with the id
of the first_page. Only one of starting_after
and ending_before
can be used at a time.
Request
curl --request GET \
--url https://api.osma.com/members?limit=3&starting_after=mem_2C7PFuvIgJJyrEnf9SxOgndg3Fv \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv'
Response
{
"has_next": true
"data": [
{
"id": "mem_28bnB4MCh2qygiyaHQ6jNGUbl10",
"created_at": "2022-05-02T12:20:13.080819+00:00",
"updated_at": "2022-05-02T12:20:13.080819+00:00",
"name": "Daisy Demo",
"email": "daisy@osma.com",
"status": "active",
"status_transitions": [],
"date_of_birth": "1993-09-16",
"biological_sex": "female",
"gender_identity": null,
"live_mode": false,
"metadata": {}
},
{...},
{...}
]
}
Osma’s API provides the ability to setup webhooks to notify your systems when an event occurs (for example when a task is completed). A webhook event consists of a POST
request with a JSON
payload to an endpoint of your choice (the "webhook endpoint").
Webhook endpoints can be registered and managed through the Osma Dashboard. They can be registered in test or live mode and configured to “listen” for one or more specific events. Webhook endpoints must use https
.
Each webhook endpoint is assigned a “signing secret”. Each webhook event (request to your endpoint) will contain a request header called osma-signature
. In combination these can be used to validate that a webhook event was sent by Osma, and can be used to prevent replay attacks.
Requests to webhook endpoints that fail will be retried on an exponential backoff schedule.
All resources that are updatable, such as members
and tasks
, contain a metadata
object field that you can store custom key-value pairs on. This is useful for storing your own reference IDs.
Each metadata
object can contain up to 50 keys. Key names can be up to 50 characters long, and values up to 500 characters long.
curl --request POST \
--url https://api.osma.com/members/mem_28bnB4MCh2qygiyaHQ6jNGUbl10 \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv' \
--data '{
"metadata": {
"internal_member_id": "92cb3caf-00ea-4e24-8c30-32e23d2253d5"
}
}'
{
"id": "mem_28bnB4MCh2qygiyaHQ6jNGUbl10",
"created_at": "2022-05-02T12:20:13.080819+00:00",
"updated_at": "2022-05-02T12:20:13.080819+00:00",
"name": "Daisy Demo",
"email": "daisy@osma.com",
"status": "active",
"status_transitions": [],
"date_of_birth": "1993-09-16",
"biological_sex": "female",
"gender_identity": null,
"live_mode": false,
"metadata": {
"internal_member_id": "92cb3caf-00ea-4e24-8c30-32e23d2253d5"
}
}
The API supports idempotency on all POST
(create / update) requests via the HTTP idempotency header. When the header is provided, POST
requests can be retried without the risk of duplicate resources being created (or other side effects). The API caches the first response (even if it was an error) and returns it on subsequent requests with the same idempotency key.
Idempotency keys are created by the API consumer and can be any unique string up to 255 characters long, such as UUIDs. When retrying an idempotent request, the parameters must remain the same or the API returns an error.
curl --request POST \
--url https://api.osma.com/tasks \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv'
--header 'idempotency-key: 534fee46-cbaa-4bb7-b5ae-cee5bae4679d'
--data '{
...
}'
As of today, no backwards-incompatible changes have been made to the API. When they are made, the Osma API will use ISO-8601 dates to represent new version.
The default API version of an organization can be managed in the Osma dashboard, which will affect all subsequent API requests. However, this can be overridden by setting the osma-api-version
header to a specific ISO-8601 date. This means backwards-incompatible changes to the API can be handled incrementally per-endpoint.
curl --request GET \
--url https://api.osma.com/tasks \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv'
--header 'osma-api-version: 2022-05-22'
Osma’s API uses rate limits to prevent unexpected bursts of traffic. Each endpoint is limited to 100 requests per second in live mode, and 20 requests per second in test mode.
When exceeded, the API will return an error with HTTP status code 429
.
These limits can be increased if required - please contact Osma support to request this.
{
"type": "rate_limit_error",
"message": "Rate limit exceeded",
"status_code": 429
}
Each request made to the API is associated with a request identifier, that the API returns in the request-id
response header. Logs will be viewable in the Osma dashboard in the near future. Providing request ids when contacting support regarding API questions or issues helps to provide support quicker.
This resource represents the tasks that are created and completed as part of your organization's workflows.
Each task is essentially an instance of a "task template". These templates are created in the Osma dashboard. They can be built using our no-code template builder, or they can be "renderless". Renderless tasks have an external_url
field which represents where the task should be completed. For example, if you have a task to review a failed payment in Stripe, it could be the url to the failed payment in the stripe dashboard.
post/tasksget/tasks/:idpost/tasks/:iddelete/tasks/:idget/tasks
{
"id": "task_2BU1ecNdKXgRfRxPSjFDXfmv0tV",
"template": "update_blood_pressure",
"status": "in_progress",
"priority": "routine",
"member": "mem_2C7PFuvIgJJyrEnf9SxOgndg3Fv",
"description": "Update member's blood pressure",
"parameters": {},
"data": {
"blood_pressure": {
"systolic": "120",
"diastolic": "80"
}
},
"external_url": null,
"live_mode": false,
"metadata": {}
"created_at": "2022-07-04T14:45:45.338647+00:00",
"updated_at": "2022-07-19T15:03:02.991466+00:00",
"status_transitions": [
{
"to": "in_progress",
"from": "ready",
"timestamp": "2022-07-04T14:45:45.486051+00:00"
}
]
}
Returns a task object with HTTP status code 201
if successful or an error if one or more request parameters are invalid.
curl --request POST \
--url https://api.osma.com/tasks \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv'
--data '{
"template": "update_blood_pressure",
"description": "Update member's blood pressure",
"member": "mem_2C7PFuvIgJJyrEnf9SxOgndg3Fv"
}'
{
"id": "task_2BU1ecNdKXgRfRxPSjFDXfmv0tV",
"template": "update_blood_pressure",
"status": "ready",
"priority": "routine",
"member": "mem_2C7PFuvIgJJyrEnf9SxOgndg3Fv",
"description": "Update member's blood pressure",
"parameters": {},
"data": {},
"external_url": null,
"live_mode": false,
"metadata": {}
"created_at": "2022-07-04T14:45:45.338647+00:00",
"updated_at": "2022-07-04T14:45:45.338647+00:00",
"status_transitions": []
}
Retrieves a task based on the id
provided in the URL. Returns a task object with HTTP status code 200
if a valid ID is provided or an error if no task is found in the same mode as the API key provided.
curl --request GET \
--url https://api.osma.com/tasks/task_2BU1ecNdKXgRfRxPSjFDXfmv0tV \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv'
{
"id": "task_2BU1ecNdKXgRfRxPSjFDXfmv0tV",
"template": "update_blood_pressure",
"status": "ready",
"priority": "routine",
"member": "mem_2C7PFuvIgJJyrEnf9SxOgndg3Fv",
"description": "Update member's blood pressure",
"parameters": {},
"data": {},
"external_url": null,
"live_mode": false,
"metadata": {}
"created_at": "2022-07-04T14:45:45.338647+00:00",
"updated_at": "2022-07-04T14:45:45.338647+00:00",
"status_transitions": []
}
Updates a task based on the id
provided in the URL.
Returns a task object with HTTP status code 200
if successful or an error if one or more request parameters are invalid.
Request
curl --request POST \
--url https://api.osma.com/tasks/task_2BU1ecNdKXgRfRxPSjFDXfmv0tV \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv' \
--data '{
"priority": "high_priority"
}'
{
"id": "task_2BU1ecNdKXgRfRxPSjFDXfmv0tV",
"template": "update_blood_pressure",
"status": "ready",
"priority": "high_priority",
"member": "mem_2C7PFuvIgJJyrEnf9SxOgndg3Fv",
"description": "Update member's blood pressure",
"parameters": {},
"data": {},
"external_url": null,
"live_mode": false,
"metadata": {}
"created_at": "2022-07-04T14:45:45.338647+00:00",
"updated_at": "2022-07-19T15:03:02.991466+00:00"
"status_transitions": []
}
Soft deletes a task based on the id
provided in the URL.
Returns a task object with HTTP status code 200
if successful. The status
field will be changed to deleted
and a new item will be added to status_transitions
to reflect the change.
curl --request DELETE \
--url https://api.osma.com/tasks/task_2BU1ecNdKXgRfRxPSjFDXfmv0tV \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv'
{
"id": "task_2BU1ecNdKXgRfRxPSjFDXfmv0tV",
"template": "update_blood_pressure",
"status": "deleted",
"priority": "routine",
"member": "mem_2C7PFuvIgJJyrEnf9SxOgndg3Fv",
"description": "Update member's blood pressure",
"parameters": {},
"data": {},
"external_url": null,
"live_mode": false,
"metadata": {}
"created_at": "2022-07-04T14:45:45.338647+00:00",
"updated_at": "2022-07-19T15:03:02.991466+00:00",
"status_transitions": [
{
"to": "in_progress",
"from": "ready",
"timestamp": "2022-07-04T14:45:45.486051+00:00"
},
{
"to": "deleted",
"from": "in_progress",
"timestamp": "2022-07-19T14:55:41.103539+00:00"
}
],
}
Retrieves a paginated list of task objects.
curl --request GET \
--url https://api.osma.com/tasks?limit=3 \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv'
{
"has_next": true
"data": [
{
"id": "task_2BU1ecNdKXgRfRxPSjFDXfmv0tV",
"template": "update_blood_pressure",
"status": "ready",
"priority": "routine",
"member": "mem_2C7PFuvIgJJyrEnf9SxOgndg3Fv",
"description": "Update member's blood pressure",
"parameters": {},
"data": {},
"external_url": null,
"live_mode": false,
"metadata": {}
"created_at": "2022-07-04T14:45:45.338647+00:00",
"updated_at": "2022-07-04T14:45:45.338647+00:00",
"status_transitions": []
},
{...},
{...}
]
}
This resource represents members that your organization serves. It lets you create tasks related to a member and keep track of workflows that relate to the same member.
post/membersget/members/:idpost/members/:iddelete/members/:idget/members
{
"id": "mem_28bnB4MCh2qygiyaHQ6jNGUbl10",
"created_at": "2022-05-02T12:20:13.080819+00:00",
"updated_at": "2022-05-02T12:20:13.080819+00:00",
"name": "Daisy Demo",
"email": "daisy@osma.com",
"status": "active",
"status_transitions": [],
"date_of_birth": "1993-09-16",
"biological_sex": "female",
"gender_identity": null,
"live_mode": false,
"metadata": {}
}
Returns a member object with HTTP status code 201
if successful or an error if one or more request parameters are invalid.
curl --request POST \
--url https://api.osma.com/members \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv'
--data '{
"name": "Daisy Demo",
"email: "daisy@osma.com",
"date_of_birth": "1993-09-16",
"biological_sex": "female"
}'
{
"id": "mem_28bnB4MCh2qygiyaHQ6jNGUbl10",
"created_at": "2022-05-02T12:20:13.080819+00:00",
"updated_at": "2022-05-02T12:20:13.080819+00:00",
"reference_id": null,
"name": "Daisy Demo",
"email": "daisy@osma.com",
"active": true,
"date_of_birth": "1993-09-16",
"biological_sex": "female",
"gender": null,
"live_mode": false,
"metadata": {}
}
Retrieves a member resource based on the id
provided in the URL. Returns a member object with HTTP status code 200
if a valid ID is provided or an error if no member is found in the same mode as the API key provided.
curl --request GET \
--url https://api.osma.com/members/mem_28bnB4MCh2qygiyaHQ6jNGUbl10 \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv'
{
"id": "mem_28bnB4MCh2qygiyaHQ6jNGUbl10",
"created_at": "2022-05-02T12:20:13.080819+00:00",
"updated_at": "2022-05-02T12:20:13.080819+00:00",
"name": "Daisy Demo",
"email": "daisy@osma.com",
"status": "active",
"status_transitions": [],
"date_of_birth": "1993-09-16",
"biological_sex": "female",
"gender_identity": null,
"live_mode": false,
"metadata": {}
}
Updates a member based on the id
provided in the URL.
Returns a member object with HTTP status code 200
if successful or an error if one or more request parameters are invalid.
Request
curl --request POST \
--url https://api.osma.com/members/mem_28bnB4MCh2qygiyaHQ6jNGUbl10 \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv' \
--data '{
"email": "daisy_new_email@osma.com"
}'
{
"id": "mem_28bnB4MCh2qygiyaHQ6jNGUbl10",
"created_at": "2022-05-02T12:20:13.080819+00:00",
"updated_at": "2022-07-19T16:12:50.142969+00:00",
"name": "Daisy Demo",
"email": "daisy_new_email@osma.com",
"status": "active",
"status_transitions": [],
"date_of_birth": "1993-09-16",
"biological_sex": "female",
"gender_identity": null,
"live_mode": false,
"metadata": {}
}
Soft deletes a member based on the id
provided in the URL.
Returns a member object with HTTP status code 200
if successful or an error if one or more request parameters are invalid. The status
field will be changed to deleted
and a new item will be added to status_transitions
to reflect the change.
curl --request DELETE \
--url https://api.osma.com/members/mem_28bnB4MCh2qygiyaHQ6jNGUbl10 \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv'
{
"id": "mem_28bnB4MCh2qygiyaHQ6jNGUbl10",
"created_at": "2022-05-02T12:20:13.080819+00:00",
"updated_at": "2022-05-02T12:20:13.080819+00:00",
"name": "Daisy Demo",
"email": "daisy@osma.com",
"status": "deleted",
"status_transitions": [
{
"to": "deleted",
"from": "active",
"timestamp": "2022-07-19T15:20:43.075563+00:00"
}
],
"date_of_birth": "1993-09-16",
"biological_sex": "female",
"gender_identity": null,
"live_mode": false,
"metadata": {}
}
Retrieves a paginated list of member objects.
curl --request GET \
--url https://api.osma.com/members?limit=3 \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv'
{
"has_next": true
"data": [
{
"id": "mem_28bnB4MCh2qygiyaHQ6jNGUbl10",
"created_at": "2022-05-02T12:20:13.080819+00:00",
"updated_at": "2022-05-02T12:20:13.080819+00:00",
"name": "Daisy Demo",
"email": "daisy@osma.com",
"status": "active",
"status_transitions": [],
"date_of_birth": "1993-09-16",
"biological_sex": "female",
"gender_identity": null,
"live_mode": false,
"metadata": {}
},
{...},
{...}
]
}
The user resource represents the users added to your organization through the Osma dashboard. Currently, users can only be managed through the Osma dashboard. We do provide GET
endpoints so that you can retrieve users' id
s and their roles so that you can programatically assign tasks.
One key difference to other resources is that the users resource is identical in live and test mode.
get/users/:idget/users
{
"id": "mem_28bnB4MCh2qygiyaHQ6jNGUbl10",
"created_at": "2022-05-02T12:20:13.080819+00:00",
"updated_at": "2022-05-02T12:20:13.080819+00:00",
"reference_id": null,
"name": "Daisy Demo",
"email": "daisy@osma.com",
"active": true,
"date_of_birth": "1993-09-16",
"biological_sex": "female",
"gender": null,
"live_mode": false,
"metadata": {}
}
Retrieves a user resource based on the id
provided in the URL. Returns a user object with HTTP status code 200
if a valid ID is provided or an error if no member is found in the same mode as the API key provided.
curl --request GET \
--url https://api.osma.com/members/mem_28bnB4MCh2qygiyaHQ6jNGUbl10 \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv'
{
"id": "mem_28bnB4MCh2qygiyaHQ6jNGUbl10",
"created_at": "2022-05-02T12:20:13.080819+00:00",
"updated_at": "2022-05-02T12:20:13.080819+00:00",
"reference_id": null,
"name": "Daisy Demo",
"email": "daisy@osma.com",
"active": true,
"date_of_birth": "1993-09-16",
"biological_sex": "female",
"gender": null,
"live_mode": false,
"metadata": {}
}
Retrieves a paginated list of user objects.
curl --request GET \
--url https://api.osma.com/members?limit=3 \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv'
{
"has_next": true
"data": [
{
"id": "mem_28bnB4MCh2qygiyaHQ6jNGUbl10",
"created_at": "2022-05-02T12:20:13.080819+00:00",
"updated_at": "2022-05-02T12:20:13.080819+00:00",
"reference_id": null,
"name": "Daisy Demo",
"email": "daisy@osma.com",
"active": true,
"date_of_birth": "1993-09-16",
"biological_sex": "female",
"gender": null,
"live_mode": false,
"metadata": {}
},
{...},
{...}
]
}
Some tasks may include file upload components enabling users to upload files as they complete tasks. To enable retrieving these files, tasks include fileId
s in the data
object. The GET files/:id
endpoint enables these files to be retrieved, by returning an expiring pre-signed URLs from which the file data can be downloaded.
get/files/:id
curl --request GET \
--url https://api.osma.com/members/mem_28bnB4MCh2qygiyaHQ6jNGUbl10 \
--header 'osma-api-key: sk_test_27NecW2jYLhV2gkB5lby1F22Fxv'
{
"id": "mem_28bnB4MCh2qygiyaHQ6jNGUbl10",
"created_at": "2022-05-02T12:20:13.080819+00:00",
"updated_at": "2022-05-02T12:20:13.080819+00:00",
"reference_id": null,
"name": "Daisy Demo",
"email": "daisy@osma.com",
"active": true,
"date_of_birth": "1993-09-16",
"biological_sex": "female",
"gender": null,
"live_mode": false,
"metadata": {}
}