API Function: Get Messages of Status - trifork/dpk-docs GitHub Wiki

Get Messages of Status

The endpoint is reachable at /api/v1/messages-of-status and takes three query parameter from (required), to (optional), and status (required).

Returns all messages with the specified status if sent to the system during the specified time period. It is only possible to see the status of messages sent by the caller and not messages by other clients.

Example

GET https://dpk.test.tcs.trifork.cloud/api/v1/messages-of-status?status=DELIVERED&from=2025-05-12&to=2025-06-01

Returns the following json content:

{
    "status": "Success",
    "result": [
        {
            "messageId": "6dcbd8f8-cb0e-475a-848b-fe45516b5a22",
            "status": "DELIVERED",
            "date": "2025-05-12 10:45:00"
        }
    ]
}

Status Types

A message can be in one of the following states:

Status Description
PENDING Waiting to be dispatched by the dispatcher service
DISPATCHED Dispatched to Digital Post and waiting for receipt
DELIVERED Delivered to Digital Post or Strålfors
FAILED Failed to deliver and/or dispatch, see the status info field
IGNORED Caller attempted to send to Digital Post but recipient is non-digital and no backup/physical template is specified

Errors

In case of an error, the service responds with a status code 40x or 50x and corresponding JSON value:

{
    "status": "Failed",
    "error_code": "NOT_FOUND_MESSAGEID"
}

The following request error codes may be returned by the system:

Error Code Description/Reason Status
INTERNAL_ERROR An internal error occured while processing the request 500
BAD_CERTIFICATE The provided TLS certificate contained invalid information 401
UNKNOWN_STATUS_REQUESTED The status query parameter is invalid 400
INVALID_FROM_DATE The from query parameter is invalid 400
INVALID_TO_DATE The to query parameter is invalid 400
FUTURE_DATE The from query parameter specifies a date in the future 400
FROM_DATE_AFTER_TO_DATE The from date is after the to date 400
DATE_PERIOD_TOO_LONG The amount of days to get messages for exceeds 31 days 400