Record a Coverage batch
curl --request POST \
--url https://api.heyrafiki.space/v1/coverage_batches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'X-Heyrafiki-Artifact-Reference: <x-heyrafiki-artifact-reference>' \
--data '
{
"contract_version": "2026-08-01",
"batch_reference": "<string>",
"batch_version": "<string>",
"source_contract_reference": "<string>",
"generated_at": "2023-11-07T05:31:56Z",
"records": [
{
"coverage_reference": "<string>",
"record_version": "<string>",
"tenant_reference": "<string>",
"member_reference": "<string>",
"plan_name": "<string>",
"service_code": "<string>",
"amount_limit": 4503599627370496,
"remaining_sessions": 50000,
"authorization_required": true,
"coordination_priority": 50,
"valid_from": "2023-11-07T05:31:56Z",
"valid_until": "2023-11-07T05:31:56Z"
}
]
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'X-Heyrafiki-Artifact-Reference': '<x-heyrafiki-artifact-reference>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
contract_version: '2026-08-01',
batch_reference: '<string>',
batch_version: '<string>',
source_contract_reference: '<string>',
generated_at: '2023-11-07T05:31:56Z',
records: [
{
coverage_reference: '<string>',
record_version: '<string>',
tenant_reference: '<string>',
member_reference: '<string>',
plan_name: '<string>',
service_code: '<string>',
amount_limit: 4503599627370496,
remaining_sessions: 50000,
authorization_required: true,
coordination_priority: 50,
valid_from: '2023-11-07T05:31:56Z',
valid_until: '2023-11-07T05:31:56Z'
}
]
})
};
fetch('https://api.heyrafiki.space/v1/coverage_batches', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.heyrafiki.space/v1/coverage_batches"
payload = {
"contract_version": "2026-08-01",
"batch_reference": "<string>",
"batch_version": "<string>",
"source_contract_reference": "<string>",
"generated_at": "2023-11-07T05:31:56Z",
"records": [
{
"coverage_reference": "<string>",
"record_version": "<string>",
"tenant_reference": "<string>",
"member_reference": "<string>",
"plan_name": "<string>",
"service_code": "<string>",
"amount_limit": 4503599627370496,
"remaining_sessions": 50000,
"authorization_required": True,
"coordination_priority": 50,
"valid_from": "2023-11-07T05:31:56Z",
"valid_until": "2023-11-07T05:31:56Z"
}
]
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"X-Heyrafiki-Artifact-Reference": "<x-heyrafiki-artifact-reference>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.heyrafiki.space/v1/coverage_batches"
payload := strings.NewReader("{\n \"contract_version\": \"2026-08-01\",\n \"batch_reference\": \"<string>\",\n \"batch_version\": \"<string>\",\n \"source_contract_reference\": \"<string>\",\n \"generated_at\": \"2023-11-07T05:31:56Z\",\n \"records\": [\n {\n \"coverage_reference\": \"<string>\",\n \"record_version\": \"<string>\",\n \"tenant_reference\": \"<string>\",\n \"member_reference\": \"<string>\",\n \"plan_name\": \"<string>\",\n \"service_code\": \"<string>\",\n \"amount_limit\": 4503599627370496,\n \"remaining_sessions\": 50000,\n \"authorization_required\": true,\n \"coordination_priority\": 50,\n \"valid_from\": \"2023-11-07T05:31:56Z\",\n \"valid_until\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("X-Heyrafiki-Artifact-Reference", "<x-heyrafiki-artifact-reference>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"object": "coverage_batch_result",
"batch_reference": "<string>",
"artifact_sha256": "<string>",
"total": 250,
"recorded": 250,
"replayed": 250,
"observations": [
{
"id": "<string>",
"object": "coverage_observation",
"coverage_id": "<string>",
"source": "payer_api",
"source_contract_reference": "<string>",
"external_coverage_reference": "<string>",
"source_version": "<string>",
"snapshot_version": 2,
"status": "active",
"service_code": "<string>",
"amount_limit": {
"currency": "KES",
"value": 2
},
"remaining_sessions": 1,
"authorization_required": true,
"coordination_priority": 2,
"valid_from": "2023-11-07T05:31:56Z",
"valid_until": "2023-11-07T05:31:56Z",
"observed_at": "2023-11-07T05:31:56Z"
}
]
}{
"object": "coverage_batch_result",
"batch_reference": "<string>",
"artifact_sha256": "<string>",
"total": 250,
"recorded": 250,
"replayed": 250,
"observations": [
{
"id": "<string>",
"object": "coverage_observation",
"coverage_id": "<string>",
"source": "payer_api",
"source_contract_reference": "<string>",
"external_coverage_reference": "<string>",
"source_version": "<string>",
"snapshot_version": 2,
"status": "active",
"service_code": "<string>",
"amount_limit": {
"currency": "KES",
"value": 2
},
"remaining_sessions": 1,
"authorization_required": true,
"coordination_priority": 2,
"valid_from": "2023-11-07T05:31:56Z",
"valid_until": "2023-11-07T05:31:56Z",
"observed_at": "2023-11-07T05:31:56Z"
}
]
}{
"error": {
"code": "<string>",
"message": "<string>",
"docs": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"docs": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"docs": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"docs": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"docs": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"docs": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"docs": "<string>"
}
}Record a Coverage batch
Validates and records a versioned payer Coverage batch. Requires coverages:write.
POST
/
coverage_batches
Record a Coverage batch
curl --request POST \
--url https://api.heyrafiki.space/v1/coverage_batches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'X-Heyrafiki-Artifact-Reference: <x-heyrafiki-artifact-reference>' \
--data '
{
"contract_version": "2026-08-01",
"batch_reference": "<string>",
"batch_version": "<string>",
"source_contract_reference": "<string>",
"generated_at": "2023-11-07T05:31:56Z",
"records": [
{
"coverage_reference": "<string>",
"record_version": "<string>",
"tenant_reference": "<string>",
"member_reference": "<string>",
"plan_name": "<string>",
"service_code": "<string>",
"amount_limit": 4503599627370496,
"remaining_sessions": 50000,
"authorization_required": true,
"coordination_priority": 50,
"valid_from": "2023-11-07T05:31:56Z",
"valid_until": "2023-11-07T05:31:56Z"
}
]
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'X-Heyrafiki-Artifact-Reference': '<x-heyrafiki-artifact-reference>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
contract_version: '2026-08-01',
batch_reference: '<string>',
batch_version: '<string>',
source_contract_reference: '<string>',
generated_at: '2023-11-07T05:31:56Z',
records: [
{
coverage_reference: '<string>',
record_version: '<string>',
tenant_reference: '<string>',
member_reference: '<string>',
plan_name: '<string>',
service_code: '<string>',
amount_limit: 4503599627370496,
remaining_sessions: 50000,
authorization_required: true,
coordination_priority: 50,
valid_from: '2023-11-07T05:31:56Z',
valid_until: '2023-11-07T05:31:56Z'
}
]
})
};
fetch('https://api.heyrafiki.space/v1/coverage_batches', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.heyrafiki.space/v1/coverage_batches"
payload = {
"contract_version": "2026-08-01",
"batch_reference": "<string>",
"batch_version": "<string>",
"source_contract_reference": "<string>",
"generated_at": "2023-11-07T05:31:56Z",
"records": [
{
"coverage_reference": "<string>",
"record_version": "<string>",
"tenant_reference": "<string>",
"member_reference": "<string>",
"plan_name": "<string>",
"service_code": "<string>",
"amount_limit": 4503599627370496,
"remaining_sessions": 50000,
"authorization_required": True,
"coordination_priority": 50,
"valid_from": "2023-11-07T05:31:56Z",
"valid_until": "2023-11-07T05:31:56Z"
}
]
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"X-Heyrafiki-Artifact-Reference": "<x-heyrafiki-artifact-reference>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.heyrafiki.space/v1/coverage_batches"
payload := strings.NewReader("{\n \"contract_version\": \"2026-08-01\",\n \"batch_reference\": \"<string>\",\n \"batch_version\": \"<string>\",\n \"source_contract_reference\": \"<string>\",\n \"generated_at\": \"2023-11-07T05:31:56Z\",\n \"records\": [\n {\n \"coverage_reference\": \"<string>\",\n \"record_version\": \"<string>\",\n \"tenant_reference\": \"<string>\",\n \"member_reference\": \"<string>\",\n \"plan_name\": \"<string>\",\n \"service_code\": \"<string>\",\n \"amount_limit\": 4503599627370496,\n \"remaining_sessions\": 50000,\n \"authorization_required\": true,\n \"coordination_priority\": 50,\n \"valid_from\": \"2023-11-07T05:31:56Z\",\n \"valid_until\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("X-Heyrafiki-Artifact-Reference", "<x-heyrafiki-artifact-reference>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"object": "coverage_batch_result",
"batch_reference": "<string>",
"artifact_sha256": "<string>",
"total": 250,
"recorded": 250,
"replayed": 250,
"observations": [
{
"id": "<string>",
"object": "coverage_observation",
"coverage_id": "<string>",
"source": "payer_api",
"source_contract_reference": "<string>",
"external_coverage_reference": "<string>",
"source_version": "<string>",
"snapshot_version": 2,
"status": "active",
"service_code": "<string>",
"amount_limit": {
"currency": "KES",
"value": 2
},
"remaining_sessions": 1,
"authorization_required": true,
"coordination_priority": 2,
"valid_from": "2023-11-07T05:31:56Z",
"valid_until": "2023-11-07T05:31:56Z",
"observed_at": "2023-11-07T05:31:56Z"
}
]
}{
"object": "coverage_batch_result",
"batch_reference": "<string>",
"artifact_sha256": "<string>",
"total": 250,
"recorded": 250,
"replayed": 250,
"observations": [
{
"id": "<string>",
"object": "coverage_observation",
"coverage_id": "<string>",
"source": "payer_api",
"source_contract_reference": "<string>",
"external_coverage_reference": "<string>",
"source_version": "<string>",
"snapshot_version": 2,
"status": "active",
"service_code": "<string>",
"amount_limit": {
"currency": "KES",
"value": 2
},
"remaining_sessions": 1,
"authorization_required": true,
"coordination_priority": 2,
"valid_from": "2023-11-07T05:31:56Z",
"valid_until": "2023-11-07T05:31:56Z",
"observed_at": "2023-11-07T05:31:56Z"
}
]
}{
"error": {
"code": "<string>",
"message": "<string>",
"docs": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"docs": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"docs": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"docs": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"docs": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"docs": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"docs": "<string>"
}
}Authorizations
bearerAuthapiKeyAuth
A sandbox or production secret key.
Headers
A caller-owned key for safely retrying one write.
Required string length:
8 - 255Stable reference for the source artifact retained by the payer.
Required string length:
1 - 190Pattern:
^[A-Za-z0-9][A-Za-z0-9:._/-]*$Body
application/json
Allowed value:
"2026-08-01"Required string length:
1 - 220Pattern:
^[A-Za-z0-9][A-Za-z0-9:._/-]*$Required string length:
1 - 120Required string length:
1 - 220Pattern:
^[A-Za-z0-9][A-Za-z0-9:._/-]*$Required array length:
1 - 500 elementsShow child attributes
Show child attributes
Response
A replayed Coverage batch result
Allowed value:
"coverage_batch_result"Pattern:
^[a-f0-9]{64}$Required range:
1 <= x <= 500Required range:
0 <= x <= 500Required range:
0 <= x <= 500Required array length:
1 - 500 elementsShow child attributes
Show child attributes
Last modified on August 10, 2026
Was this page helpful?

