Record a Coverage observation
curl --request POST \
--url https://api.heyrafiki.space/v1/coverages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"source_contract_reference": "<string>",
"external_coverage_reference": "<string>",
"source_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",
"observed_at": "2023-11-07T05:31:56Z",
"evidence_references": [
"<string>"
]
}
'import requests
url = "https://api.heyrafiki.space/v1/coverages"
payload = {
"source_contract_reference": "<string>",
"external_coverage_reference": "<string>",
"source_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",
"observed_at": "2023-11-07T05:31:56Z",
"evidence_references": ["<string>"]
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
source_contract_reference: '<string>',
external_coverage_reference: '<string>',
source_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',
observed_at: '2023-11-07T05:31:56Z',
evidence_references: ['<string>']
})
};
fetch('https://api.heyrafiki.space/v1/coverages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.heyrafiki.space/v1/coverages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source_contract_reference' => '<string>',
'external_coverage_reference' => '<string>',
'source_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',
'observed_at' => '2023-11-07T05:31:56Z',
'evidence_references' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.heyrafiki.space/v1/coverages"
payload := strings.NewReader("{\n \"source_contract_reference\": \"<string>\",\n \"external_coverage_reference\": \"<string>\",\n \"source_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 \"observed_at\": \"2023-11-07T05:31:56Z\",\n \"evidence_references\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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))
}HttpResponse<String> response = Unirest.post("https://api.heyrafiki.space/v1/coverages")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source_contract_reference\": \"<string>\",\n \"external_coverage_reference\": \"<string>\",\n \"source_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 \"observed_at\": \"2023-11-07T05:31:56Z\",\n \"evidence_references\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.heyrafiki.space/v1/coverages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source_contract_reference\": \"<string>\",\n \"external_coverage_reference\": \"<string>\",\n \"source_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 \"observed_at\": \"2023-11-07T05:31:56Z\",\n \"evidence_references\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"coverage_id": "<string>",
"source_contract_reference": "<string>",
"external_coverage_reference": "<string>",
"source_version": "<string>",
"snapshot_version": 2,
"service_code": "<string>",
"amount_limit": {
"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"
}{
"id": "<string>",
"object": "<string>",
"coverage_id": "<string>",
"source_contract_reference": "<string>",
"external_coverage_reference": "<string>",
"source_version": "<string>",
"snapshot_version": 2,
"service_code": "<string>",
"amount_limit": {
"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>"
}
}Record a Coverage observation
Appends a payer source observation and updates its Coverage snapshot. Requires coverages:write.
POST
/
coverages
Record a Coverage observation
curl --request POST \
--url https://api.heyrafiki.space/v1/coverages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"source_contract_reference": "<string>",
"external_coverage_reference": "<string>",
"source_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",
"observed_at": "2023-11-07T05:31:56Z",
"evidence_references": [
"<string>"
]
}
'import requests
url = "https://api.heyrafiki.space/v1/coverages"
payload = {
"source_contract_reference": "<string>",
"external_coverage_reference": "<string>",
"source_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",
"observed_at": "2023-11-07T05:31:56Z",
"evidence_references": ["<string>"]
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
source_contract_reference: '<string>',
external_coverage_reference: '<string>',
source_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',
observed_at: '2023-11-07T05:31:56Z',
evidence_references: ['<string>']
})
};
fetch('https://api.heyrafiki.space/v1/coverages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.heyrafiki.space/v1/coverages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source_contract_reference' => '<string>',
'external_coverage_reference' => '<string>',
'source_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',
'observed_at' => '2023-11-07T05:31:56Z',
'evidence_references' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.heyrafiki.space/v1/coverages"
payload := strings.NewReader("{\n \"source_contract_reference\": \"<string>\",\n \"external_coverage_reference\": \"<string>\",\n \"source_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 \"observed_at\": \"2023-11-07T05:31:56Z\",\n \"evidence_references\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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))
}HttpResponse<String> response = Unirest.post("https://api.heyrafiki.space/v1/coverages")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source_contract_reference\": \"<string>\",\n \"external_coverage_reference\": \"<string>\",\n \"source_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 \"observed_at\": \"2023-11-07T05:31:56Z\",\n \"evidence_references\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.heyrafiki.space/v1/coverages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source_contract_reference\": \"<string>\",\n \"external_coverage_reference\": \"<string>\",\n \"source_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 \"observed_at\": \"2023-11-07T05:31:56Z\",\n \"evidence_references\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"coverage_id": "<string>",
"source_contract_reference": "<string>",
"external_coverage_reference": "<string>",
"source_version": "<string>",
"snapshot_version": 2,
"service_code": "<string>",
"amount_limit": {
"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"
}{
"id": "<string>",
"object": "<string>",
"coverage_id": "<string>",
"source_contract_reference": "<string>",
"external_coverage_reference": "<string>",
"source_version": "<string>",
"snapshot_version": 2,
"service_code": "<string>",
"amount_limit": {
"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>"
}
}Authorizations
bearerAuthapiKeyAuth
A sandbox or production secret key.
Headers
A caller-owned key for safely retrying one write.
Required string length:
8 - 255Body
application/json
Required string length:
1 - 220Pattern:
^[A-Za-z0-9][A-Za-z0-9:._/-]*$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:._/-]*$An opaque payer reference. Do not send a name, contact detail or government identifier.
Required string length:
1 - 220Pattern:
^[A-Za-z0-9][A-Za-z0-9:._/-]*$Required string length:
1 - 160Required string length:
1 - 220Pattern:
^[A-Za-z0-9][A-Za-z0-9:._/-]*$Available options:
active, paused, exhausted, expired Available options:
KES, USD, EUR, GBP Per-Session limit in the currency's minor unit.
Required range:
1 <= x <= 9007199254740991Required range:
0 <= x <= 1000001 is primary. Leave null when coordination does not apply.
Required range:
1 <= x <= 100Timestamp carried by the payer source.
Required array length:
1 - 20 elementsRequired string length:
1 - 220Pattern:
^[A-Za-z0-9][A-Za-z0-9:._/-]*$Response
The original observation for an idempotent replay
Pattern:
^cobs_[A-Za-z0-9_-]+$Allowed value:
"coverage_observation"Pattern:
^cov_[A-Za-z0-9_-]+$Available options:
payer_api, batch_file Required range:
x >= 1Available options:
active, paused, exhausted, expired Show child attributes
Show child attributes
Required range:
x >= 0Required range:
x >= 1Last modified on August 6, 2026
⌘I

