/v1/letter_batchesCreate up to 100 Letters in one request
Each item accepts a public HTTPS file_url or Base64-encoded file_base64. Carebit creates all Letters together. If any item fails validation, no Letters are created.
Required API scopes: letters.create
Parameters
Idempotency-Key
header · required
string
Client-generated idempotency key. Required for every POST/PATCH write. Replay of the same key with the same body returns the stored response with an
Idempotency-Replayed: trueheader. Same key + different body returns422 idempotency_key_reused. A duplicate that arrives while the first request is still in flight returns409 idempotency_conflictwithRetry-After: 1.
Request body
application/json
itemsarrayrequiredThe letters to create. Items are processed in their submitted order.
itemsobjectautomatically_create_resource_permission_for_patientbooleanWhether Carebit should automatically share the letter with the patient after processing.
booking_idstring | null · uuidThe identifier of the booking associated with the letter, or null when it is not linked to a booking.
clinician_idstring | null · uuidThe identifier of the clinician associated with the letter, or null when none is assigned.
descriptionstring | nullA description of the Letter.
file_base64string · byteThe letter bytes encoded as Base64. Provide this with
filenameinstead offile_url. The decoded file can be at most 7 MB.file_urlstring · uriThe public HTTPS URL that Carebit can fetch.
filenamestring | nullThe filename to use for the letter. Required with
file_base64; defaults to the remote file's filename for URL sources.notify_patient_of_resource_permissionbooleanWhether Carebit should notify the patient when the letter is shared with them.
patient_idstring · uuidThe identifier of the patient that the letter belongs to.
statusstringThe workflow status to assign to the letter.
Allowed values:
awaiting_receipt | awaiting_review | awaiting_sending | complete | draft | reviewedtitlestringThe display title of the letter.
Responses
The batch was accepted. Poll it for each file's import status.
completed_countintegerrequiredThe number of items that finished processing successfully.
created_atstring · date-timerequiredAn ISO 8601 timestamp in UTC, with a
Zsuffix. For example,2026-07-01T09:00:00Z.failed_countintegerrequiredThe number of items that finished processing with an error.
idstring · uuidrequiredThe resource's unique identifier, formatted as an RFC 4122 version 4 UUID.
itemsarrayrequiredThe import items in their original request order.
itemsobjectcreated_resourcestring | null · urirequiredThe URL of the resource created for a succeeded item. Null unless
statusissucceeded.created_resource_idstring | null · uuidrequiredThe identifier of the resource created for a succeeded item. Null unless
statusissucceeded.created_resource_typestring | nullrequiredThe type of resource created for a succeeded item. Null unless
statusissucceeded.Allowed values:
null | Attachment | Letter | Note | TestResulterrorobject | nullrequiredThe failure details for this item. Null unless the item has failed.
codestring | nullrequiredThe machine-readable error code.
messagestring | nullrequiredA message that explains how the item failed.
idstring · uuidrequiredThe resource's unique identifier, formatted as an RFC 4122 version 4 UUID.
objectanyrequiredAlways
remote_file_import_batch_item.positionintegerrequiredThe zero-based position of the item in the submitted batch.
statusstringrequiredThe current download, validation, and malware-scanning status of the item.
Allowed values:
failed | pending | processing | succeeded
linksobjectrequiredURLs to related resources.
selfstring · urirequiredThe full URL of a related resource.
objectanyrequiredDiscriminator value emitted at
object.resource_typestringrequiredThe type of resource created by every item in the batch.
Allowed values:
letter | note | test_resultstatusstringrequiredThe current download, validation, and malware-scanning status of the batch.
Allowed values:
completed | pending | processingtotal_countintegerrequiredThe total number of items submitted in the batch.
updated_atstring · date-timerequiredAn ISO 8601 timestamp in UTC, with a
Zsuffix. For example,2026-07-01T09:00:00Z.
Example
{
"id": "ebc38802-f219-4c7b-8136-8e963a0c69e0",
"object": "remote_file_import_batch",
"completed_count": 0,
"created_at": "2026-01-01T09:00:00Z",
"failed_count": 0,
"items":
"id": "57bed2bf-e2e1-463b-8a96-643e3817a8b8",
"object": "remote_file_import_batch_item",
"created_resource": "https://api.carebit.co/v1/letters/c3d4e5f6-0718-49ab-acde-f01234567890",
"created_resource_id": "7e09a8e3-e3c1-4dee-863b-85d56e4329da",
"created_resource_type": null,
"error": null,
"position": 0,
"status": "failed"
}
],
"links":
"self": "https://api.carebit.co/v1/remote_file_import_batches/ebc38802-f219-4c7b-8136-8e963a0c69e0"
},
"resource_type": "letter",
"status": "completed",
"total_count": 1,
"updated_at": "2026-01-01T09:00:00Z"
}The Idempotency-Key header is missing (idempotency_key_required) or exceeds 255 characters (idempotency_key_too_long).
errorobjectrequiredThe structured details that describe why the request failed.
codestringrequiredThe machine-readable error code.
errorsarray | nullAdditional errors from a failed validation.
itemsobjectcodestringThe machine-readable code for this validation error.
messagestringA message that explains this validation error.
paramstring | nullThe name of the parameter that caused this validation error, when known.
messagestringrequiredA message that explains the error and how to resolve it.
paramstring | nullThe name of the parameter that caused the error, when known.
typestringrequiredThe high-level category of the error.
Allowed values:
authentication_error | permission_error | invalid_request_error | rate_limit_error | api_error
Example
{
"error":
"code": "resource_missing",
"errors":
"code": "resource_missing",
"message": "The requested resource was not found.",
"param": "patient_id"
}
],
"message": "The requested resource was not found.",
"param": "patient_id",
"type": "authentication_error"
}
}The access token is missing, invalid, expired, or revoked.
errorobjectrequiredThe structured details that describe why the request failed.
codestringrequiredThe machine-readable error code.
errorsarray | nullAdditional errors from a failed validation.
itemsobjectcodestringThe machine-readable code for this validation error.
messagestringA message that explains this validation error.
paramstring | nullThe name of the parameter that caused this validation error, when known.
messagestringrequiredA message that explains the error and how to resolve it.
paramstring | nullThe name of the parameter that caused the error, when known.
typestringrequiredThe high-level category of the error.
Allowed values:
authentication_error | permission_error | invalid_request_error | rate_limit_error | api_error
Example
{
"error":
"code": "resource_missing",
"errors":
"code": "resource_missing",
"message": "The requested resource was not found.",
"param": "patient_id"
}
],
"message": "The requested resource was not found.",
"param": "patient_id",
"type": "authentication_error"
}
}The access token lacks the required scope, or the project is disabled.
errorobjectrequiredThe structured details that describe why the request failed.
codestringrequiredThe machine-readable error code.
errorsarray | nullAdditional errors from a failed validation.
itemsobjectcodestringThe machine-readable code for this validation error.
messagestringA message that explains this validation error.
paramstring | nullThe name of the parameter that caused this validation error, when known.
messagestringrequiredA message that explains the error and how to resolve it.
paramstring | nullThe name of the parameter that caused the error, when known.
typestringrequiredThe high-level category of the error.
Allowed values:
authentication_error | permission_error | invalid_request_error | rate_limit_error | api_error
Example
{
"error":
"code": "resource_missing",
"errors":
"code": "resource_missing",
"message": "The requested resource was not found.",
"param": "patient_id"
}
],
"message": "The requested resource was not found.",
"param": "patient_id",
"type": "authentication_error"
}
}Error response.
errorobjectrequiredThe structured details that describe why the request failed.
codestringrequiredThe machine-readable error code.
errorsarray | nullAdditional errors from a failed validation.
itemsobjectcodestringThe machine-readable code for this validation error.
messagestringA message that explains this validation error.
paramstring | nullThe name of the parameter that caused this validation error, when known.
messagestringrequiredA message that explains the error and how to resolve it.
paramstring | nullThe name of the parameter that caused the error, when known.
typestringrequiredThe high-level category of the error.
Allowed values:
authentication_error | permission_error | invalid_request_error | rate_limit_error | api_error
Example
{
"error":
"code": "resource_missing",
"errors":
"code": "resource_missing",
"message": "The requested resource was not found.",
"param": "patient_id"
}
],
"message": "The requested resource was not found.",
"param": "patient_id",
"type": "authentication_error"
}
}A concurrent request holds the idempotency lease (idempotency_conflict). Retry after the delay indicated by Retry-After.
errorobjectrequiredThe structured details that describe why the request failed.
codestringrequiredThe machine-readable error code.
errorsarray | nullAdditional errors from a failed validation.
itemsobjectcodestringThe machine-readable code for this validation error.
messagestringA message that explains this validation error.
paramstring | nullThe name of the parameter that caused this validation error, when known.
messagestringrequiredA message that explains the error and how to resolve it.
paramstring | nullThe name of the parameter that caused the error, when known.
typestringrequiredThe high-level category of the error.
Allowed values:
authentication_error | permission_error | invalid_request_error | rate_limit_error | api_error
Example
{
"error":
"code": "resource_missing",
"errors":
"code": "resource_missing",
"message": "The requested resource was not found.",
"param": "patient_id"
}
],
"message": "The requested resource was not found.",
"param": "patient_id",
"type": "authentication_error"
}
}The Idempotency-Key was previously used with a different request body (idempotency_key_reused), or the request body failed validation.
errorobjectrequiredThe structured details that describe why the request failed.
codestringrequiredThe machine-readable error code.
errorsarray | nullAdditional errors from a failed validation.
itemsobjectcodestringThe machine-readable code for this validation error.
messagestringA message that explains this validation error.
paramstring | nullThe name of the parameter that caused this validation error, when known.
messagestringrequiredA message that explains the error and how to resolve it.
paramstring | nullThe name of the parameter that caused the error, when known.
typestringrequiredThe high-level category of the error.
Allowed values:
authentication_error | permission_error | invalid_request_error | rate_limit_error | api_error
Example
{
"error":
"code": "resource_missing",
"errors":
"code": "resource_missing",
"message": "The requested resource was not found.",
"param": "patient_id"
}
],
"message": "The requested resource was not found.",
"param": "patient_id",
"type": "authentication_error"
}
}Too many requests. Retry after the delay indicated by Retry-After.
errorobjectrequiredThe structured details that describe why the request failed.
codestringrequiredThe machine-readable error code.
errorsarray | nullAdditional errors from a failed validation.
itemsobjectcodestringThe machine-readable code for this validation error.
messagestringA message that explains this validation error.
paramstring | nullThe name of the parameter that caused this validation error, when known.
messagestringrequiredA message that explains the error and how to resolve it.
paramstring | nullThe name of the parameter that caused the error, when known.
typestringrequiredThe high-level category of the error.
Allowed values:
authentication_error | permission_error | invalid_request_error | rate_limit_error | api_error
Example
{
"error":
"code": "resource_missing",
"errors":
"code": "resource_missing",
"message": "The requested resource was not found.",
"param": "patient_id"
}
],
"message": "The requested resource was not found.",
"param": "patient_id",
"type": "authentication_error"
}
}