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

# List Notification Template Versions

> List versions of a notification template.



## OpenAPI

````yaml /openapi-specs/openapi.documented.yml get /notifications/{id}/versions
openapi: 3.0.1
info:
  title: Courier
  description: The Courier REST API.
  version: 0.0.1
servers:
  - url: https://api.courier.com
    description: Production
security: []
paths:
  /notifications/{id}/versions:
    get:
      tags:
        - Notification Templates
      summary: List Notification Template Versions
      description: List versions of a notification template.
      operationId: notifications_listVersions
      parameters:
        - name: id
          in: path
          description: Template ID (nt_ prefix).
          required: true
          schema:
            type: string
        - name: cursor
          in: query
          description: >-
            Opaque pagination cursor from a previous response. Omit for the
            first page.
          required: false
          schema:
            type: string
        - name: limit
          in: query
          description: Maximum number of versions to return per page. Default 10, max 10.
          required: false
          schema:
            type: integer
            default: 10
            maximum: 10
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotificationTemplateVersionListResponse'
              examples:
                VersionHistory:
                  value:
                    versions:
                      - version: draft
                        created: 1774037925522
                        creator: user_abc
                        has_changes: true
                      - version: published:v003
                        created: 1774037924446
                        creator: user_abc
                      - version: v002
                        created: 1774037923967
                        creator: user_def
                      - version: v001
                        created: 1774037922000
                        creator: user_def
                    paging:
                      cursor: null
                      more: false
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequest'
              examples:
                InvalidCursor:
                  value:
                    type: invalid_request_error
                    message: Invalid cursor format
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFound'
              examples:
                TemplateNotFound:
                  value:
                    type: invalid_request_error
                    message: Notification template nt_nonexistent not found
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Courier from '@trycourier/courier';


            const client = new Courier({
              apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
            });


            const notificationTemplateVersionListResponse = await
            client.notifications.listVersions('id');


            console.log(notificationTemplateVersionListResponse.paging);
        - lang: Python
          source: >-
            import os

            from courier import Courier


            client = Courier(
                api_key=os.environ.get("COURIER_API_KEY"),  # This is the default and can be omitted
            )

            notification_template_version_list_response =
            client.notifications.list_versions(
                id="id",
            )

            print(notification_template_version_list_response.paging)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/trycourier/courier-go\"\n\t\"github.com/trycourier/courier-go/option\"\n)\n\nfunc main() {\n\tclient := courier.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tnotificationTemplateVersionListResponse, err := client.Notifications.ListVersions(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tcourier.NotificationListVersionsParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", notificationTemplateVersionListResponse.Paging)\n}\n"
        - lang: Java
          source: >-
            package com.courier.example;


            import com.courier.client.CourierClient;

            import com.courier.client.okhttp.CourierOkHttpClient;

            import
            com.courier.models.notifications.NotificationListVersionsParams;

            import
            com.courier.models.notifications.NotificationTemplateVersionListResponse;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    CourierClient client = CourierOkHttpClient.fromEnv();

                    NotificationTemplateVersionListResponse notificationTemplateVersionListResponse = client.notifications().listVersions("id");
                }
            }
        - lang: Ruby
          source: >-
            require "courier"


            courier = Courier::Client.new(api_key: "My API Key")


            notification_template_version_list_response =
            courier.notifications.list_versions("id")


            puts(notification_template_version_list_response)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Courier\Client;

            use Courier\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API
            Key');


            try {
              $notificationTemplateVersionListResponse = $client
                ->notifications
                ->listVersions('id', cursor: 'cursor', limit: 10);

              var_dump($notificationTemplateVersionListResponse);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: C#
          source: >-
            using System;

            using Courier;

            using Courier.Models.Notifications;


            CourierClient client = new();


            NotificationListVersionsParams parameters = new() { ID = "id" };


            var notificationTemplateVersionListResponse = await
            client.Notifications.ListVersions(parameters);


            Console.WriteLine(notificationTemplateVersionListResponse);
        - lang: CLI
          source: |-
            courier notifications list-versions \
              --api-key 'My API Key' \
              --id id
components:
  schemas:
    NotificationTemplateVersionListResponse:
      title: NotificationTemplateVersionListResponse
      type: object
      properties:
        versions:
          type: array
          items:
            $ref: '#/components/schemas/VersionNode'
        paging:
          $ref: '#/components/schemas/Paging'
      required:
        - versions
        - paging
    BadRequest:
      title: BadRequest
      type: object
      properties:
        type:
          type: string
          enum:
            - invalid_request_error
      required:
        - type
      allOf:
        - $ref: '#/components/schemas/BaseError'
    NotFound:
      title: NotFound
      type: object
      properties:
        type:
          type: string
          enum:
            - invalid_request_error
      required:
        - type
      allOf:
        - $ref: '#/components/schemas/BaseError'
    VersionNode:
      title: VersionNode
      type: object
      description: A version entry for a notification template.
      properties:
        version:
          type: string
          description: >-
            Version identifier. One of "draft", "published:vNNN" (current
            published version), or "vNNN" (historical version).
        created:
          type: integer
          format: int64
          description: Epoch milliseconds when this version was created.
        creator:
          type: string
          description: User ID of the version creator.
        has_changes:
          type: boolean
          description: >-
            Whether the draft has unpublished changes. Only present on the draft
            version.
      required:
        - version
        - created
        - creator
    Paging:
      title: Paging
      type: object
      properties:
        cursor:
          type: string
          nullable: true
        more:
          type: boolean
      required:
        - more
    BaseError:
      title: BaseError
      type: object
      properties:
        message:
          type: string
          description: A message describing the error that occurred.
      required:
        - message
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````