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": 1
}
]
}
'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: 1}]
})
};
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": 1
}
]
}
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>"
}
]
}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 batch_rejected, with the reason in detail) — nothing is written to the mirror. A pharmacy that is not set to take a stock report from another system is refused (409 external_stock_mode_required) before anything is read or written. Permission: a key needs EITHER inventory.external_stock:write (the narrow permission for exactly this report; any paid pharmacy plan, including the listing plan) OR inventory.stock:write (Team and above). A key with only the narrow permission cannot read, adjust or receive stock.
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": 1
}
]
}
'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: 1}]
})
};
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": 1
}
]
}
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>"
}
]
}