Send prescription specification
const url = 'https://sender.sandbox-api.kivra.com/dr/v1/prescription-specifications';const options = { method: 'POST', headers: { 'Content-Type': 'application/json;profile=https://se.kivra.com/schemas/json/retail/ps/v1.0' }, body: '{ "business_unit": { "contact": { "address": { "locality": "City", "postal_code": "123 45", "street_address": "Östra storgatan 6", "type": { "type": "business" } }, "email": "info@ta.se", "phone": "0123456789" }, "name": "Test apoteket", "organization_number": "112233-4455", "service_id": "16399966934684ed5d5d534373b33ef89846460b06", "unit_id": "5" }, "cashier": { "id": "T02SUIT" }, "receipt_identifier": { "sequence_number": 123456, "extended_number": { "value": "0123456123", "type": "EAN8", "context": "store" } }, "time_of_purchase": "2023-03-27T08:49:00+01:00", "customer": { "id": { "birth_date": "19900805" }, "name": "Knapp, Lena" }, "expedition": { "id": "T02 AAN631", "details": [ "Inköp på expedition T02 AAN631" ] }, "human": { "high_cost": { "previous_period": { "gross": 8982.64, "net": 2350, "start_date": "2021-07-12T08:00:00+02:00", "end_date": "2022-07-11T08:00:00+02:00" }, "current_period": { "gross": 28198.71, "net": 2400, "start_date": "2022-07-12T08:00:00+02:00", "end_date": "2023-07-11T08:00:00+02:00" }, "next_period": { "gross": 0, "net": 0, "start_date": "2023-07-13T08:00:00+02:00", "end_date": "2024-07-11T08:00:00+02:00" }, "amount_left_to_reimbursement": { "gross": 100, "net": 100 } } }, "amount_with_benefit": 58.27, "amount_without_benefit": 5.38, "amount_paid_by_benefit": 58.27, "amount_to_pay": 5.38 }'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://sender.sandbox-api.kivra.com/dr/v1/prescription-specifications \ --header 'Content-Type: application/json;profile=https://se.kivra.com/schemas/json/retail/ps/v1.0' \ --data '{ "business_unit": { "contact": { "address": { "locality": "City", "postal_code": "123 45", "street_address": "Östra storgatan 6", "type": { "type": "business" } }, "email": "info@ta.se", "phone": "0123456789" }, "name": "Test apoteket", "organization_number": "112233-4455", "service_id": "16399966934684ed5d5d534373b33ef89846460b06", "unit_id": "5" }, "cashier": { "id": "T02SUIT" }, "receipt_identifier": { "sequence_number": 123456, "extended_number": { "value": "0123456123", "type": "EAN8", "context": "store" } }, "time_of_purchase": "2023-03-27T08:49:00+01:00", "customer": { "id": { "birth_date": "19900805" }, "name": "Knapp, Lena" }, "expedition": { "id": "T02 AAN631", "details": [ "Inköp på expedition T02 AAN631" ] }, "human": { "high_cost": { "previous_period": { "gross": 8982.64, "net": 2350, "start_date": "2021-07-12T08:00:00+02:00", "end_date": "2022-07-11T08:00:00+02:00" }, "current_period": { "gross": 28198.71, "net": 2400, "start_date": "2022-07-12T08:00:00+02:00", "end_date": "2023-07-11T08:00:00+02:00" }, "next_period": { "gross": 0, "net": 0, "start_date": "2023-07-13T08:00:00+02:00", "end_date": "2024-07-11T08:00:00+02:00" }, "amount_left_to_reimbursement": { "gross": 100, "net": 100 } } }, "amount_with_benefit": 58.27, "amount_without_benefit": 5.38, "amount_paid_by_benefit": 58.27, "amount_to_pay": 5.38 }'Sends a prescription specification to Kivra. Following credentials are needed in order to create prescription specifications.
-
storeID : add to the “service_id” element in the prescription specification body
-
token : the JWT bearer token used for authorization. Partner, chain or store token can be used.
Access scope
- PARTNER
- CHAIN
Headers
The Content-Type must be set according to the prescription specification format:
Content-Type: application/json;profile=https://se.kivra.com/schemas/json/retail/ps/v1.0
The profile tells what version of the JSON schema that the prescription specification is based on.
This schema is available for download in JSON.
Request Bodyrequired
Section titled “Request Bodyrequired”Sends a prescription specification
Prescription specification issued by pharmacies and connected to a receipt in Kivra. The format is based on discussions with pharmacies and data from the Swedish eHealth Agency. Version 1.0 — first release 2025-03-11.
object
Merchant information (the pharmacy issuing the specification).
object
Id created when then business is registered in kivra
Internal merchant shop/business unit id
Swedish organisationsnummer or vat reg number
Merchant contact information name, address, phone etc
object
An address following the convention of http://microformats.org/wiki/hcard
object
Is address (physical/email) related to business, home, etc
object
An address following the convention of http://microformats.org/wiki/hcard
object
Is address (physical/email) related to business, home, etc
object
Generic format for phone numbers where strict format can not be enforced, use only for phone number to be displayed
A geographical coordinate
object
Identifies the person handling the purchase if applicable
object
Receipt identifiers: sequence number and/or extended number with or without barcode representation
object
A sequence number as stipulated by the swedish tax authorities, not mandatory for PS.
A more complex receipt number if applicable, must be unique in given context
object
Data that will be presented as a barcode on the receipt
Barcode representation of any data
In what context is the value (receipt number) unique, note GLOBAL can only be used if a digital receipt provider receipt id is used
ISO 8601 date/time format: YYYY-MM-DDThh:mm:ssTZD
The receipt default currency. This gives the currency for all amounts in the receipt. If applicable overriding currencies can be added to the tender parts
Amount with the high-cost benefit applied. Human prescriptions only; usually equals amount_paid_by_benefit but differs when insurances are involved.
Amount without the high-cost benefit. Given on both animal and human prescriptions.
Amount paid by the high-cost benefit. Human prescriptions only; usually equals amount_with_benefit but differs when insurances are involved.
Final amount the customer pays. Given on both animal and human prescriptions.
Total amounts and types, for example vat, gross, paid. Included when the prescription contains goods/services the customer pays tax on; the VAT is then added here.
Paid: gross amount including discount and rounding.
object
True if amount to customer, example: on return of goods
Use with total/paid if paid gives the total amount paid and the subtotal gives what is given by customer
object
Optional explaining text
object
Arbitray array of strings used where additional info needed at some part
Use with total/paid if paid gives the total amount paid and the subtotal gives what is returned to customer
object
Optional explaining text
object
Arbitray array of strings used where additional info needed at some part
Gross: total including vat, excluding discounts
object
True if amount to customer, example: on return of goods
Gross: total including vat.
One or more sub totals eligible for bonus
object
True if amount to customer, example: on return of goods
Optional explaining text
object
Arbitray array of strings used where additional info needed at some part
Loyalty points gained/lost in transaction
One or more sub totals for example one for each tax percentage
object
True if amount to customer, example: on return of goods
Optional explaining text
object
Arbitray array of strings used where additional info needed at some part
Can be one of the total amount types or any other description what the subtotal is about
Tax releated total
object
True if amount to customer, example: on return of goods
Add sub total for each tax percentage used
One or more sub totals, one for each tax percentage
object
True if amount to customer, example: on return of goods
Amount including tax amount
Amount excluding tax amount
Defines valid customer identifiers
object
The customer ssn
object
Swedish personnummer 12 digits
The customer birth date
object
Birth date 10 digits, e.g 19920101
The company registration number, when a company is the customer
object
Company registration number used as id when the customer is a company
Defines customer information, like name, address, loyalty program.
object
object
An address following the convention of http://microformats.org/wiki/hcard
object
Is address (physical/email) related to business, home, etc
object
An address following the convention of http://microformats.org/wiki/hcard
object
Is address (physical/email) related to business, home, etc
object
Generic format for phone numbers where strict format can not be enforced, use only for phone number to be displayed
A geographical coordinate
object
Specific properties related to animal prescriptions
object
Identifies the animal to whom the prescription is issued
Human prescription data related to high-cost reimbursement, given as previous, current and next periods.
object
Defines properties related to high cost reimbursement
object
object
High cost period start date-time, ISO 8601 date/time format: YYYY-MM-DDThh:mm:ssTZD
High cost period end date-time, ISO 8601 date/time format: YYYY-MM-DDThh:mm:ssTZD
object
High cost period start date-time, ISO 8601 date/time format: YYYY-MM-DDThh:mm:ssTZD
High cost period end date-time, ISO 8601 date/time format: YYYY-MM-DDThh:mm:ssTZD
object
High cost period start date-time, ISO 8601 date/time format: YYYY-MM-DDThh:mm:ssTZD
High cost period end date-time, ISO 8601 date/time format: YYYY-MM-DDThh:mm:ssTZD
The amount left to high cost reimbursement
object
List of medications issued and their cost. Can be used on both animal and human prescriptions.
object
Expedition / prescription details. The format differs between pharmacies, so the user-facing part is carried as the ‘details’ array of strings.
object
Expedition id, prescription id, etc. For internal use and exchange with other systems
This is what the user will see
Prescription specification issued by pharmacies and connected to a receipt in Kivra. The format is based on discussions with pharmacies and data from the Swedish eHealth Agency. Version 1.0 — first release 2025-03-11.
object
Merchant information (the pharmacy issuing the specification).
object
Id created when then business is registered in kivra
Internal merchant shop/business unit id
Swedish organisationsnummer or vat reg number
Merchant contact information name, address, phone etc
object
An address following the convention of http://microformats.org/wiki/hcard
object
Is address (physical/email) related to business, home, etc
object
An address following the convention of http://microformats.org/wiki/hcard
object
Is address (physical/email) related to business, home, etc
object
Generic format for phone numbers where strict format can not be enforced, use only for phone number to be displayed
A geographical coordinate
object
Identifies the person handling the purchase if applicable
object
Receipt identifiers: sequence number and/or extended number with or without barcode representation
object
A sequence number as stipulated by the swedish tax authorities, not mandatory for PS.
A more complex receipt number if applicable, must be unique in given context
object
Data that will be presented as a barcode on the receipt
Barcode representation of any data
In what context is the value (receipt number) unique, note GLOBAL can only be used if a digital receipt provider receipt id is used
ISO 8601 date/time format: YYYY-MM-DDThh:mm:ssTZD
The receipt default currency. This gives the currency for all amounts in the receipt. If applicable overriding currencies can be added to the tender parts
Amount with the high-cost benefit applied. Human prescriptions only; usually equals amount_paid_by_benefit but differs when insurances are involved.
Amount without the high-cost benefit. Given on both animal and human prescriptions.
Amount paid by the high-cost benefit. Human prescriptions only; usually equals amount_with_benefit but differs when insurances are involved.
Final amount the customer pays. Given on both animal and human prescriptions.
Total amounts and types, for example vat, gross, paid. Included when the prescription contains goods/services the customer pays tax on; the VAT is then added here.
Paid: gross amount including discount and rounding.
object
True if amount to customer, example: on return of goods
Use with total/paid if paid gives the total amount paid and the subtotal gives what is given by customer
object
Optional explaining text
object
Arbitray array of strings used where additional info needed at some part
Use with total/paid if paid gives the total amount paid and the subtotal gives what is returned to customer
object
Optional explaining text
object
Arbitray array of strings used where additional info needed at some part
Gross: total including vat, excluding discounts
object
True if amount to customer, example: on return of goods
Gross: total including vat.
One or more sub totals eligible for bonus
object
True if amount to customer, example: on return of goods
Optional explaining text
object
Arbitray array of strings used where additional info needed at some part
Loyalty points gained/lost in transaction
One or more sub totals for example one for each tax percentage
object
True if amount to customer, example: on return of goods
Optional explaining text
object
Arbitray array of strings used where additional info needed at some part
Can be one of the total amount types or any other description what the subtotal is about
Tax releated total
object
True if amount to customer, example: on return of goods
Add sub total for each tax percentage used
One or more sub totals, one for each tax percentage
object
True if amount to customer, example: on return of goods
Amount including tax amount
Amount excluding tax amount
Defines valid customer identifiers
object
The customer ssn
object
Swedish personnummer 12 digits
The customer birth date
object
Birth date 10 digits, e.g 19920101
The company registration number, when a company is the customer
object
Company registration number used as id when the customer is a company
Defines customer information, like name, address, loyalty program.
object
object
An address following the convention of http://microformats.org/wiki/hcard
object
Is address (physical/email) related to business, home, etc
object
An address following the convention of http://microformats.org/wiki/hcard
object
Is address (physical/email) related to business, home, etc
object
Generic format for phone numbers where strict format can not be enforced, use only for phone number to be displayed
A geographical coordinate
object
Specific properties related to animal prescriptions
object
Identifies the animal to whom the prescription is issued
Human prescription data related to high-cost reimbursement, given as previous, current and next periods.
object
Defines properties related to high cost reimbursement
object
object
High cost period start date-time, ISO 8601 date/time format: YYYY-MM-DDThh:mm:ssTZD
High cost period end date-time, ISO 8601 date/time format: YYYY-MM-DDThh:mm:ssTZD
object
High cost period start date-time, ISO 8601 date/time format: YYYY-MM-DDThh:mm:ssTZD
High cost period end date-time, ISO 8601 date/time format: YYYY-MM-DDThh:mm:ssTZD
object
High cost period start date-time, ISO 8601 date/time format: YYYY-MM-DDThh:mm:ssTZD
High cost period end date-time, ISO 8601 date/time format: YYYY-MM-DDThh:mm:ssTZD
The amount left to high cost reimbursement
object
List of medications issued and their cost. Can be used on both animal and human prescriptions.
object
Expedition / prescription details. The format differs between pharmacies, so the user-facing part is carried as the ‘details’ array of strings.
object
Expedition id, prescription id, etc. For internal use and exchange with other systems
This is what the user will see
Examples
Human specification one — expedition id & high-cost reimbursement
Basic elements of a human prescription specification based on an expedition id, with high-cost periods and amount left to high-cost reimbursement.
{ "business_unit": { "contact": { "address": { "locality": "City", "postal_code": "123 45", "street_address": "Östra storgatan 6", "type": { "type": "business" } }, "email": "info@ta.se", "phone": "0123456789" }, "name": "Test apoteket", "organization_number": "112233-4455", "service_id": "16399966934684ed5d5d534373b33ef89846460b06", "unit_id": "5" }, "cashier": { "id": "T02SUIT" }, "receipt_identifier": { "sequence_number": 123456, "extended_number": { "value": "0123456123", "type": "EAN8", "context": "store" } }, "time_of_purchase": "2023-03-27T08:49:00+01:00", "customer": { "id": { "birth_date": "19900805" }, "name": "Knapp, Lena" }, "expedition": { "id": "T02 AAN631", "details": [ "Inköp på expedition T02 AAN631" ] }, "human": { "high_cost": { "previous_period": { "gross": 8982.64, "net": 2350, "start_date": "2021-07-12T08:00:00+02:00", "end_date": "2022-07-11T08:00:00+02:00" }, "current_period": { "gross": 28198.71, "net": 2400, "start_date": "2022-07-12T08:00:00+02:00", "end_date": "2023-07-11T08:00:00+02:00" }, "next_period": { "gross": 0, "net": 0, "start_date": "2023-07-13T08:00:00+02:00", "end_date": "2024-07-11T08:00:00+02:00" }, "amount_left_to_reimbursement": { "gross": 100, "net": 100 } } }, "amount_with_benefit": 58.27, "amount_without_benefit": 5.38, "amount_paid_by_benefit": 58.27, "amount_to_pay": 5.38}Human specification two — prescription id & issuers
Basic elements of a human prescription specification based on a prescription id and a list of prescription issuers.
{ "business_unit": { "contact": { "address": { "locality": "City", "postal_code": "23456", "street_address": "Västra storgatan 99", "type": { "type": "business" } }, "email": "info@ata.se", "phone": "0123456788" }, "name": "Another test apotek", "organization_number": "112233-4466", "service_id": "16399966934684ed5d5d534373b33ef89846460b07", "unit_id": "ata-01" }, "cashier": { "id": "01CSR" }, "receipt_identifier": { "sequence_number": 29547, "extended_number": { "value": "029547123", "type": "EAN8", "context": "chain" } }, "time_of_purchase": "2015-04-21T16:30:00+02:00", "customer": { "id": { "civic_registration_number": "199008051234" }, "name": "Knapp, Lena" }, "expedition": { "id": "154789798A", "details": [ "Inköp på recept 154789798A", "Läkare Kinhult Anna-Carin", "Läkare Winsö Katarina" ] }, "human": { "high_cost": { "previous_period": { "gross": 0, "net": 0, "start_date": "2014-02-14T08:00:00+02:00", "end_date": "2015-02-13T08:00:00+02:00" }, "current_period": { "gross": 2116.8, "net": 2116.8, "start_date": "2015-02-14T08:00:00+02:00", "end_date": "2016-02-13T08:00:00+02:00" }, "next_period": { "gross": 0, "net": 0, "start_date": "2016-02-14T08:00:00+02:00", "end_date": "2017-02-13T08:00:00+02:00" } } }, "amount_with_benefit": 0, "amount_without_benefit": 1929.8, "amount_paid_by_benefit": 0, "amount_to_pay": 1929.8}Animal specification — animal id & medications
Basic elements of an animal prescription specification, identified by an animal id and carrying the list of prescribed medications.
{ "business_unit": { "contact": { "address": { "locality": "City", "postal_code": "123 45", "street_address": "Östra storgatan 6", "type": { "type": "business" } }, "email": "info@testapotek.se", "phone": "0123456789" }, "name": "Testapoteket AB", "organization_number": "112233-4455", "service_id": "16399966934684ed5d5d534373b33ef89846460b06", "unit_id": "5" }, "cashier": { "id": "T02SUIT" }, "receipt_identifier": { "sequence_number": 123457, "extended_number": { "value": "0123457123", "type": "EAN8", "context": "store" } }, "time_of_purchase": "2023-03-31T08:49:00+01:00", "customer": { "id": { "civic_registration_number": "199008051234" }, "name": "Knapp, Lena" }, "expedition": { "id": "T02 AAN633", "details": [ "Inköp på expedition T02 AAN633" ] }, "medications": [ { "description": "Metacam för hund och katt", "amount": 3050 } ], "animal": { "id": "Fido" }, "amount_without_benefit": 3050, "amount_to_pay": 3050}Responses
Section titled “Responses”Prescription specification successfully sent
object
Example
{ "receipt_id": "15594097555922f97bfeb148d6b9a6ef76f76ebdce", "prescription_specification_id": "17594097555904f97adeb148d6b9a6ef76f76ebdba"}Bad request
object
Examples
{ "error_code": "40000", "error_message": "body is missing from the request"}{ "error_code": "40001", "error_message": "body is missing required fields or has invalid fields"}{ "error_code": "40002", "error_message": "unsupported content type header"}{ "error_code": "40004", "error_message": "resource not found"}Unauthorized
object
Examples
{ "error_code": "40100", "error_message": "jwt token missing"}{ "error_code": "40101", "error_message": "jwt token expired"}{ "error_code": "40102", "error_message": "jwt token invalid"}Internal server error
object
Example
{ "error_code": "50000", "short_message": "internal server error", "long_message": "unknown error ocurred"}