> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Save Push Notification Template

> Saves push notification template for title

## Error codes

This operation may return the following PlayFab errors:

| Error | Code |
| --- | --- |
| InvalidLocalizedPushNotificationLanguage | 1409 |
| MissingLocalizedPushNotificationMessage | 1410 |
| PushNotificationTemplateAndroidPayloadMissingNotificationBody | 1416 |
| PushNotificationTemplateContainsInvalidAndroidPayload | 1414 |
| PushNotificationTemplateContainsInvalidIosPayload | 1413 |
| PushNotificationTemplateInvalidPayload | 1408 |
| PushNotificationTemplateInvalidSyntax | 1419 |
| PushNotificationTemplateIosPayloadMissingNotificationBody | 1415 |
| PushNotificationTemplateMissingDefaultVersion | 1418 |
| PushNotificationTemplateMissingName | 1442 |
| PushNotificationTemplateMissingPlatformPayload | 1411 |
| PushNotificationTemplateNoCustomPayloadForV1 | 1420 |
| PushNotificationTemplatePayloadContainsInvalidJson | 1412 |
| TitleDefaultLanguageNotSet | 1393 |




## OpenAPI

````yaml /services/playfab/api-references/rest/server/server.openapi.json post /Server/SavePushNotificationTemplate
openapi: 3.0.0
info:
  version: '260922'
  title: PlayFab Server API
  description: >-
    Provides functionality to allow external (developer-controlled) servers to
    interact with user inventories and data in a trusted manner, and to handle
    matchmaking and client connection orchestration
  termsOfService: https://playfab.com/terms/
  contact:
    url: https://community.playfab.com/index.html
  license:
    name: Apache 2.0
    url: https://github.com/PlayFab/API_Specs/blob/master/LICENSE
servers:
  - url: https://{titleId}.playfabapi.com
    description: PlayFab title endpoint
    variables:
      titleId:
        default: your_title_id
        description: Your PlayFab title ID (hex).
security: []
tags:
  - name: Account Management
    description: Account Management APIs
  - name: Analytics
    description: Analytics APIs
  - name: Authentication
    description: Authentication APIs
  - name: Character Data
    description: Character Data APIs
  - name: Characters
    description: Characters APIs
  - name: Content
    description: Content Service APIs
  - name: Friend List Management
    description: Friend List Management APIs
  - name: Matchmaking
    description: Matchmaking APIs
  - name: Platform Specific Methods
    description: Platform Specific Methods APIs
  - name: Player Data Management
    description: Player Data Management APIs
  - name: Player Item Management
    description: Player Item Management APIs
  - name: PlayStream
    description: PlayStream Management APIs
  - name: Server-Side Cloud Script
    description: Server-Side Cloud Script APIs
  - name: Shared Group Data
    description: Shared Group Data APIs
  - name: Title-Wide Data Management
    description: Title-Wide Data Management APIs
paths:
  /Server/SavePushNotificationTemplate:
    post:
      tags:
        - Account Management
      summary: Save Push Notification Template
      description: |
        Saves push notification template for title

        ## Error codes

        This operation may return the following PlayFab errors:

        | Error | Code |
        | --- | --- |
        | InvalidLocalizedPushNotificationLanguage | 1409 |
        | MissingLocalizedPushNotificationMessage | 1410 |
        | PushNotificationTemplateAndroidPayloadMissingNotificationBody | 1416 |
        | PushNotificationTemplateContainsInvalidAndroidPayload | 1414 |
        | PushNotificationTemplateContainsInvalidIosPayload | 1413 |
        | PushNotificationTemplateInvalidPayload | 1408 |
        | PushNotificationTemplateInvalidSyntax | 1419 |
        | PushNotificationTemplateIosPayloadMissingNotificationBody | 1415 |
        | PushNotificationTemplateMissingDefaultVersion | 1418 |
        | PushNotificationTemplateMissingName | 1442 |
        | PushNotificationTemplateMissingPlatformPayload | 1411 |
        | PushNotificationTemplateNoCustomPayloadForV1 | 1420 |
        | PushNotificationTemplatePayloadContainsInvalidJson | 1412 |
        | TitleDefaultLanguageNotSet | 1393 |
      operationId: SavePushNotificationTemplate
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SavePushNotificationTemplateRequest'
        description: Represents the save push notification template request.
      responses:
        '200':
          $ref: '#/components/responses/SavePushNotificationTemplateResult'
        '400':
          $ref: '#/components/responses/ApiErrorWrapper'
      security:
        - SecretKey: []
components:
  schemas:
    SavePushNotificationTemplateRequest:
      description: Represents the save push notification template request.
      type: object
      properties:
        AndroidPayload:
          description: Android JSON for the notification template.
          type: string
        Id:
          description: Id of the push notification template.
          type: string
        IOSPayload:
          description: IOS JSON for the notification template.
          type: string
        LocalizedPushNotificationTemplates:
          allOf:
            - $ref: '#/components/schemas/LocalizedPushNotificationProperties'
          description: >-
            Dictionary of localized push notification templates with the
            language as the key.
        Name:
          description: Name of the push notification template.
          type: string
      required:
        - Name
      example:
        Id: 6bc7dbf0-075a-46e9-8e84-35737a22c6a4
        Name: F8763A987E
        AndroidPayload: >-
          {       notification:      {          body: "Some Message",         
          title: "Subject",          body_loc_key: "someLocKey"     } }
        IOSPayload: >-
          {       aps:      {          alert:          {          body: "Some
          Message",          title: "Subject",          "loc-key":
          "someLocKey"         }      } }
        LocalizedPushNotificationTemplates:
          en:
            Subject: Recent Attack
            Message: You have been attacked! Go defend your base!
          fr:
            Subject: Attaque récente
            Message: Vous avez été attaqué! Va défendre ta base!
    LocalizedPushNotificationProperties:
      description: Contains the localized push notification content.
      type: object
      properties:
        Message:
          description: Message of the localized push notification template.
          type: string
        Subject:
          description: Subject of the localized push notification template.
          type: string
    SavePushNotificationTemplateResult:
      description: Represents the save push notification template result.
      type: object
      properties:
        PushNotificationTemplateId:
          description: Id of the push notification template that was saved.
          type: string
      example:
        PushNotificationTemplateId: 6bc7dbf0-075a-46e9-8e84-35737a22c6a4
    ApiErrorWrapper:
      description: The basic wrapper around every failed API response
      type: object
      properties:
        code:
          description: Numerical HTTP code
          type: integer
        status:
          description: String HTTP code
          type: string
        error:
          description: Playfab error code
          type: string
        errorCode:
          description: Numerical PlayFab error code
          type: integer
        errorMessage:
          description: Description for the PlayFab errorCode
          type: string
        errorDetails:
          description: Detailed description of individual issues with the request object
          type: object
      required:
        - code
        - errorCode
  responses:
    SavePushNotificationTemplateResult:
      description: Represents the save push notification template result.
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: integer
                description: >-
                  The Http status code. If X-ReportErrorAsSuccess header is set
                  to true, this will report the actual http error code.
              status:
                type: string
                description: The Http status code as a string.
              data:
                $ref: '#/components/schemas/SavePushNotificationTemplateResult'
            example:
              code: 200
              status: OK
              data:
                PushNotificationTemplateId: 6bc7dbf0-075a-46e9-8e84-35737a22c6a4
    ApiErrorWrapper:
      description: This is the outer wrapper for all responses with errors
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorWrapper'
  securitySchemes:
    SecretKey:
      type: apiKey
      in: header
      name: X-SecretKey
      description: >-
        This API requires a title secret key, available to title admins, from
        PlayFab Game Manager.

````

## Related topics

- [Save Push Notification Template](/services/playfab/api-references/rest/server/account-management/save-push-notification-template.md)
- [Push notification templates](/services/playfab/live-service-management/game-configuration/title-communications/push-notifications/push-notification-templates.md)
- [PlayFab Release Notes 2019](/services/playfab/release-notes/2019.md)
- [Content & Configuration Writes Meter API Description](/services/playfab/pricing/meters/file-writes.md)
- [Delete Push Notification Template](/services/playfab/api-references/rest/server/account-management/delete-push-notification-template.md)
