General notes

All API access is over HTTPS, and accessed from:

All data is sent and received as JSON, so please ensure Content-Type: application/json; charset=utf-8 HTTP header is provided.

All entities carry a 128-bit globally unique identifier (GUID), such as: a863d62e-d53b-4651-9b7b-c80792ee1343

All timestamps are returned as yyyy-MM-dd HH:mm:ss Z in Europe/Copenhagen timezone, such as: 2019-12-31 15:59:59 +0100

Amounts use a 0.0 format, decimals separated with a dot. No thousand separator.

 

You may find the following resources helpful in your work:

  • DAWA - public API providing Danish address verification and sanitation

  • Download of DK post codes - static files

  • CVR API - public API for verification of Danish Business Codes

  • CPR explanation. Please see below for CPR validation and testing


HTTP Status Codes

OnlineFundraising will return the following HTTP Status Codes:

200 - OK

Accepted

 

201 - Created

Resource was created as requested.

 

202 - Accepted

Request will be processed asynchronously.

 

400 - Bad Request

If request data is invalid.

1 2 3 4 { "errorCode" : "10001", "errorDescription" : "..." }

 

404 - Not Found

If the resource cannot be found.

 

501 - Not Implemented

The service is not implemented.

 

500 - Internal Server Error

Something went really wrong in our end.

For error codes regarding entities, please see: Error and Cancel Codes


Testing with CPR

As your testning progress you may find yourself in need of this set of valid Danish NationalIDs (source sundhed.dk):

Valid Danish NationalIDs (CPR) for testing purposes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 You may use these dates combined with any four digits e.g. 0101601234: 010160 010164 010165 010166 010169 010170 010180 010182 010184 010185 010186 010187 010188 010189 010190 010192
CPR validation in JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 // Validate CPR-nr. function is_cpr_valid(cpr) { var res = cpr.replace(/[^0-9]/ig, ""); if (res.length !== 10) { return false; } var validDates = ['010160', '010164', '010165', '010166', '010169', '010170', '010180', '010182', '010184', '010185', '010186', '010187', '010188', '010189', '010190', '010192']; var value = res.substr(0, 6); if (contains(validDates, value)) { return true; } var cpr_arr = res.split(''); var mul_arr = "4327654321".split(''); var sum = 0; for (var i = 0; i < cpr_arr.length; i++) { sum += cpr_arr[i] * mul_arr[i]; } if (sum % 11 === 0) { return true; } else { return false; } return true; }



CPR validation in PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 // Validate CPR-nr. function is_cpr_valid($cpr) { $cleaned = preg_replace("/[^0-9]/", "", $cpr); if (strlen($cleaned) != 10) { return FALSE; } $valid_dates = Array('010160', '010164', '010165', '010166', '010169', '010170', '010180', '010182', '010184', '010185', '010186', '010187', '010188', '010189', '010190', '010192'); if (in_array(substr($cleaned, 0, 6), $valid_dates)) { return TRUE; } $cpr_arr = str_split($cleaned, 1); $mul_arr = str_split("4327654321", 1); $sum = 0; for ($i = 0; $i < count($cpr_arr); $i++) { $sum += $cpr_arr[$i] * $mul_arr[$i]; } if ($sum % 11 == 0) { return TRUE; } else { return FALSE; } }