# Get default push notification template by key

`GET /api/communications/push-notifications/default-templates/{key}`

- **Success:** `200 OK`
- **Products:** Operator (`FOH`)
- **Features:** Front of House Generic Access (`FOHGENERIC`)

HTML version: [Get default push notification template by key](https://support.gladstonesoftware.cloud/reference/communications/get-default-push-notification-template-by-key)

## Overview

Retrieves a push notification template by its key — the stable text identifier a template ships with, such as `CLASS_ALERT` — rather than by its numeric id. Reach for this when you know which scenario you are sending for but not which id the tenant has given it: numeric ids differ between tenants and environments, keys do not.

A push notification template holds the wording of the notification once per language, plus up to two tappable actions and the destination the app opens for each. The templates installed by default are `CLASS_ALERT`, `Custom Audience` and `Site Notification`; a tenant may hold others.

The response is identical in shape to [Get push notification template by template ID](get-push-notification-template-by-template-id.md) — use that one when you already have the numeric id, for example the `id` this call returns.

## Endpoint

`GET {base_url}/api/communications/push-notifications/default-templates/{key}`

`{base_url}` is the environment URL issued to your integration. See [Authenticating with Gladstone APIs](../../guides/authenticating-with-gladstone-apis.md).

## Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `key` | string | Yes | The template key to look up, matched against the template's stored key (up to 50 characters). `CLASS_ALERT`, `Custom Audience` and `Site Notification` are installed by default. An unrecognised key returns `404` rather than an empty response. |

## Sample request

```bash title="cURL"
curl -X GET '{base_url}/api/communications/push-notifications/default-templates/{key}' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true'
```

## Response fields

| Field | Type | Description |
|-------|------|-------------|
| `id` | integer (int32) | The template's numeric identifier in this tenant. Pass it to [Get push notification template by template ID](get-push-notification-template-by-template-id.md), or use it when scheduling a job against this template. It is tenant-specific — do not hard-code it across environments. |
| `typeId` | integer (int32) | The push notification type, which governs what the app does when the notification is opened. The types installed by default are `Redirect to Activity/Slot`, `No Action` and `Open App`. |
| `templateName` | string | The template's display name, up to 50 characters. May be `null`, and is not the value the key-based lookup matches on. |
| `action1RedirectTo` | integer (int32) | Where the app navigates when the notification's first action is tapped, as a redirect type id. `null` when the first action has no destination. The redirect types installed by default are `Activity slot`, `Remove class alert` and `Home Screen`. Pairs with `content[].action1Label`, which supplies the button text. |
| `action2RedirectTo` | integer (int32) | Where the app navigates when the second action is tapped, in the same form as `action1RedirectTo`. `null` when there is no second action. |
| `isActive` | boolean | Whether the template is enabled. Templates are returned by this endpoint whether or not they are active, so check this before sending with one. |
| `content` | array of object | The wording of the notification, one entry per language it has been translated into. Empty when the template has no content yet. |
| `content[].language` | string | The language this entry is written in, as a language code — `en-GB`, `cy-GB` and `en-IE` are the codes installed by default. |
| `content[].title` | string | The notification title shown on the device, up to 255 characters. |
| `content[].content` | string | The notification body shown on the device, up to 1024 characters. |
| `content[].action1Label` | string | The text on the first action button in this language, up to 50 characters. `null` when the template has no first action; the destination that action opens is `action1RedirectTo`. |
| `content[].action2Label` | string | The text on the second action button in this language, up to 50 characters. `null` when the template has no second action. |

## Sample response

```json title="200 OK"
{
  "id": 12345,
  "typeId": 12345,
  "templateName": "string",
  "action1RedirectTo": 1,
  "action2RedirectTo": 1,
  "isActive": true,
  "content": [
    {
      "language": "string",
      "title": "string",
      "content": "string",
      "action1Label": "string",
      "action2Label": "string"
    }
  ]
}
```

## Errors

| Status | Meaning | When |
|--------|---------|------|
| `404` | Not found | No template holds that key in this tenant (`The push notification template with key: {key} does not exist`). |
| `500` | Internal server error | An unexpected failure reading the template. The response has no body. |
