Sist endret: 8. aug. 2024

Get email notifications

Endpoint for retrieving the send status of all email notifications generated by a notification order.

Endpoint

GET /order/{id}/notifications/email

{id} represents the ID of the notification order to retrieve notifications for.

Authentication

This API requires authentication and the request must also include one of the following:

  • Maskinporten scope altinn:serviceowner/notifications.create (for external system callers)
  • Platform Access Token (for Altinn Apps and internal Altinn systems)

See Authentication and Authorization for more information.

Response

Response codes

  • 200 OK: The email notifications were successfully retrieved

  • 404 Not Found: No order matching the provided ID were found

    Refer to problem details in response body for further information.

  • 401 Unauthorized: Indicates a missing, invalid or expired authorization header.

  • 403 Forbidden: Indicates that required scope or Platform Access Token is missing or invalid.

Content-Type

  • application/json

Response body

The response body is formatted as an EmailNotificationSummaryExt and serialized as a JSON string.

Response body properties

orderId

Type: Guid

The ID of the notification order the listed notifications are related to

sendersReference

Type: string

The senders reference the creator provided upon the creation of the notification order

generated

Type: int

The total number of email notifications generated so far based on the notification order

succeeded

Type: int

The number of email notifications that have been sent successfully so far

notifications

Type: List<EmailNotificationWithResult>

A list of the generated notifications with send result. Each notification will include the following properties:

  • id: the ID of the notification
  • succeeded: a boolean indicating whether the send status is a successful one.
  • recipient: the contact details of the recipient that the notification is sent to.
  • sendStatus: the send status of the notification.
StatusDescription
NewThe email has been created, but has not been picked up for processing yet.
SendingThe email is being processed and will be attempted sent shortly.
SucceededThe email has been accepted by the third party email service and will be sent shortly.
DeliveredThe email was delivered to the recipient. No errors reported, making it likely it was received by the recipient.
FailedThe email was not sent due to an unspecified failure.
Failed_RecipientNotIdentifiedThe email was not sent because the recipient’s email address was not found.
Failed_InvalidEmailFormatThe email was not sent because the recipient’s email address is in an invalid format.
Failed_BouncedThe email hard bounced, which may have happened because the email address does not exist or the domain is invalid.
Failed_FilteredSpamThe email was was identified as spam, and was rejected or blocked (not quarantined).
Failed_QuarantinedThe email was quarantined (as spam, bulk mail, or phising).

Examples

Request

In the example we have included place holders for both the Platform Access and Altinn token.

You only need one of them, reference Authentication for which one applies to your use case.

curl --location 'https://platform.altinn.no/notifications/api/v1/orders/f1a1cc30-197f-4f34-8304-006ce4945fd1/notifications/email' \
--header 'Content-Type: application/json' \
--header 'PlatformAccessToken: [INSERT PLATFORM ACCESS TOKEN]' \
--header 'Authorization: Bearer [INSERT ALTINN TOKEN]' 

Response

200 OK

Response body contains the email notification summary.

{
    "orderId": "f1a1cc30-197f-4f34-8304-006ce4945fd1",
    "sendersReference": "ref-2023-12-01",
    "generated": 1,
    "succeeded": 0,
    "notifications": [
        {
            "id": "e0197ec7-3d82-4917-8329-8c9ecc4c569b",
            "succeeded": false,
            "recipient": {
                "emailAddress": "recipient@domain.com"
            },
            "sendStatus": {
                "status": "New",
                "description": "The email has been created, but has not been picked up for processing yet.",
                "lastUpdate": "2023-11-14T16:06:02.877361Z"
            }
        }
    ]
}

404 Not Found

An empty response is returned with the 404 status code.