Upload an external stock batch
curl --request POST \
--url https://api.clinikehr.com/v1/clinics/{clinic_id}/inventory/external-stock/batches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"batch_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"as_of": "2023-11-07T05:31:56Z",
"feed_source": "<string>",
"rows": [
{
"identifiers": [
{
"value": "<string>"
}
],
"quantity": 123
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
batch_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
as_of: '2023-11-07T05:31:56Z',
feed_source: '<string>',
rows: [{identifiers: [{value: '<string>'}], quantity: 123}]
})
};
fetch('https://api.clinikehr.com/v1/clinics/{clinic_id}/inventory/external-stock/batches', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.clinikehr.com/v1/clinics/{clinic_id}/inventory/external-stock/batches"
payload = {
"batch_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"as_of": "2023-11-07T05:31:56Z",
"feed_source": "<string>",
"rows": [
{
"identifiers": [{ "value": "<string>" }],
"quantity": 123
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"ok": true,
"batch_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"item_count": 123,
"matched_count": 123,
"unmatched_count": 123,
"rejected": true,
"rejected_reason": "suspicious_shrink",
"replayed": true
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}Inventory
Upload an external stock batch
Permission: inventory.stock:write Upload a batch of external stock quantities/bands for a pharmacy selling through another till. Clinic-owned key only — an organization never pushes a clinic’s own stock. batch_id doubles as the idempotency key (a replay of an already-processed batch returns the stored result, never reprocesses). Unmatched rows are counted, never guessed at, never written. A structurally invalid or suspiciously-shrunk batch is rejected (409) — nothing is written to the mirror.
POST
/
v1
/
clinics
/
{clinic_id}
/
inventory
/
external-stock
/
batches
Upload an external stock batch
curl --request POST \
--url https://api.clinikehr.com/v1/clinics/{clinic_id}/inventory/external-stock/batches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"batch_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"as_of": "2023-11-07T05:31:56Z",
"feed_source": "<string>",
"rows": [
{
"identifiers": [
{
"value": "<string>"
}
],
"quantity": 123
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
batch_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
as_of: '2023-11-07T05:31:56Z',
feed_source: '<string>',
rows: [{identifiers: [{value: '<string>'}], quantity: 123}]
})
};
fetch('https://api.clinikehr.com/v1/clinics/{clinic_id}/inventory/external-stock/batches', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.clinikehr.com/v1/clinics/{clinic_id}/inventory/external-stock/batches"
payload = {
"batch_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"as_of": "2023-11-07T05:31:56Z",
"feed_source": "<string>",
"rows": [
{
"identifiers": [{ "value": "<string>" }],
"quantity": 123
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"ok": true,
"batch_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"item_count": 123,
"matched_count": 123,
"unmatched_count": 123,
"rejected": true,
"rejected_reason": "suspicious_shrink",
"replayed": true
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/json