Invoices

{info} WARNING You are browsing the documentation for an old version of ProviderAPI.
Consider upgrading your integration to version 1.1.1


All submitted invoices will have a unique id (uuid) you will need to save if you need to track the status of the invoice.
Invoices will be queued and processed by the backend daily at 18:00 / 6PM danish time.

Invoices can have the following status:

Code Description
41 The invoice was rejected by the API
21 The invoice was accepted by the API
45 The invoice was rejected by the backend
24 The invoice was accepted by the backend

An invoice is successfully submitted when the code is: 24.

The invoice can be rejected by the backend if eg. the person is not a sygeforsikring "danmark" member. This validation is not performed by the REST API.

Endpoints

{info} Requires authentication

The invoice object

{
  "treatments": [
    {
      "treatment_type_number": "integer|required",
      "start_date": "string|date(YYYY-MM-DD)|required",
      "end_date": "string|date(YYYY-MM-DD)|required",
      "user_expense": "integer|required",
      "correction_code": "integer|required",
      "number_of_treatments": "integer|required"
    }
  ],
  "cpr": "string|required",
  "payment_by_provider": "boolean|required",
  "provider_id": "string|required",
  "payment_date": "string|date(YYYY-MM-DD)|required",
  "use_grant": "boolean|required",
  "invoice_number": "integer|required",
  "fi_code": "string|optional"
}

Attributes

treatments array is optional

treatments.user_expense The amount of user expense in øre.

treatments.correction_code must be one of the following values:

  • 0 = Positive transaction (Invoice)
  • 1 = Negative Transaction (credit note)
  • 2 = Paid by insurance company
  • 3 = Paid by municipality
  • 4 = Paid by company

invoice_number is not required when using the Validate invoice endpoint

payment_date The date for when the payment was done.

provider_id As a data provider you are required to specify your customer's provider_id.

Note: If you use version 1.1 of the api, you can use the Check permission endpoint to determine if you can use a certain provider_id.

fi_code A valid FI code. The API does not confirm the validity of the code. A correct code should be exactly 30 characters. Example fi-code: +71<+202040400010841+99999999<

Get invoice status

Retrieve information about a submitted invoice.

Method URI Headers
GET /api/invoices/{uuid} Accept: application/json
Authorization: Bearer your_token

{success} Example Success Response

Code 200

Accepted by API:

{
    "uuid": "92bc6e8c-f4d2-40f4-b871-63e478c1b240",
    "code": "21",
    "message": "Invoice received for processing"
}

Accepted by backend:

{
    "uuid": "9291fb93-8e58-4c29-8b96-a273b4f6f89f",
    "code": "24",
    "message": "Invoice accepted by backend"
}

{danger} Example Error Response

Code 401|404

{
  "message": "No query results for model [App\Invoice].",
  "status_code": 404
}

Submit invoice

Submit invoice with (or without) treatment lines.

Method URI Headers
POST /api/invoices Accept: application/json
Authorization: Bearer your_token

Request body

{
  "treatments": [
    {
      "treatment_type_number": 10105,
      "end_date": "2018-05-22",
      "user_expense": "1",
      "correction_code": "0",
      "start_date": "2018-05-22",
      "number_of_treatments": 1
    }
  ],
  "cpr": "0101585026",
  "payment_by_provider": true,
  "provider_id": "13126",
  "payment_date": "2018-05-22",
  "use_grant": true,
  "invoice_number": "123",
  "fi_code": "+71<+202040400010841+99999999<"
}

{success} Success Response

Code 201

Content

{
  "uuid": "90e00076-d2fe-4095-9764-bea00f813271",
  "code": "21",
  "message": "Invoice received for processing"
}

{danger} Error Response

Code 401|422

Content

{
  "uuid": "90e0012a-c355-4746-9539-b2c56f16868d",
  "message": "Bad request, invoice rejected",
  "errors": {
    "invoice_number": [
      "Invoice with this invoice_number is already being handled and cannot be uploaded at this stage."
    ],
    "cpr": [
      "The cpr field is required."
    ]
  },
  "code": 41,
  "error_codes": [
    "1002",
    "2000"
  ],
  "status_code": 422
}

In order to understand the different error_codes refer to our Error codes page.

Besides error codes the API returns error message(s) in a human readable format for each invalid property.

Validate invoice

Validate invoice data with (or without) treatment lines.

This can be useful before you use the Submit invoice endpoint to verify you data is correct.

Method URI Headers
POST /api/invoices/validate Accept: application/json
Authorization: Bearer your_token

Request body

invoice_number is not required when using this endpoint as it might not be known at this moment but will be validated if present.

{
  "treatments": [
    {
      "treatment_type_number": 10105,
      "end_date": "2018-05-22",
      "user_expense": "1",
      "correction_code": "0",
      "start_date": "2018-05-22",
      "number_of_treatments": 1
    }
  ],
  "cpr": "0101585026",
  "payment_by_provider": true,
  "provider_id": "13126",
  "payment_date": "2018-05-22",
  "use_grant": true,
  "invoice_number": "123",
  "fi_code": "+71<+202040400010841+99999999<"
}

{success} Success Response

Code 200

Content

{
  "message": "Invoice validated"
}

{danger} Error Response

Code 401|422

Content

{
  "uuid": "90e01355-0822-45a1-8fb5-96344bc995a1",
  "message": "Bad request, invoice rejected",
  "errors": {
    "invoice_number": [
      "Invoice with this invoice_number is already being handled and cannot be uploaded at this stage."
    ]
  },
  "code": 41,
  "error_codes": [
    "1002"
  ],
  "status_code": 422
}