Invoices


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 once daily.

Invoices can have the following status:

Code Description
REJECTED_API The invoice was rejected by the API
RECEIVED_API The invoice was accepted by the API
REJECTED_BACKEND The invoice was rejected by the backend
ACCEPTED_BACKEND The invoice was accepted by the backend

An invoice is successfully submitted when the status is: ACCEPTED_BACKEND.

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.

fi_code A valid FI code that starts with one of the following values:

  • +01
  • +04
  • +15
  • +71
  • +73
  • +75

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

{
    "data": {
        "uuid": "8df936ab-665c-40a4-b8e8-8592b89f4b17",
        "code": "RECEIVED_API",
        "message": "Received"
    }
}

{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
}