> ## 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 versions of a journey

> GET /journeys/{templateId}/versions returns the published versions of a journey, ordered with the most recently published version first.



## OpenAPI

````yaml /openapi-specs/openapi.documented.yml get /journeys/{templateId}/versions
openapi: 3.0.1
info:
  title: Courier
  description: The Courier REST API for sending and managing notifications across channels.
  version: 0.0.1
servers:
  - url: https://api.courier.com
    description: Production
security: []
paths:
  /journeys/{templateId}/versions:
    get:
      tags:
        - Journeys
      summary: List versions of a journey
      description: >-
        GET /journeys/{templateId}/versions returns the published versions of a
        journey, ordered with the most recently published version first.
      operationId: journeys_listVersions
      parameters:
        - in: path
          name: templateId
          schema:
            type: string
            minLength: 1
          required: true
          description: Journey id
      responses:
        '200':
          description: Version list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JourneyVersionsListResponse'
              examples:
                Example1:
                  summary: Two versions
                  value:
                    results:
                      - version: v2
                        name: Welcome Journey
                        created: 1715000400000
                        creator: user-1
                        published: 1715000400000
                      - version: v1
                        name: Welcome Journey
                        created: 1715000200000
                        creator: user-1
                        published: 1715000200000
                    paging:
                      more: false
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequest'
              examples:
                Example:
                  value:
                    message: Example message text
                    type: invalid_request_error
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFound'
              examples:
                Example:
                  value:
                    message: Example message text
                    type: invalid_request_error
      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 journeyVersionsListResponse = await
            client.journeys.listVersions('x');


            console.log(journeyVersionsListResponse.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
            )
            journey_versions_list_response = client.journeys.list_versions(
                "x",
            )
            print(journey_versions_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\tjourneyVersionsListResponse, err := client.Journeys.ListVersions(context.TODO(), \"x\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", journeyVersionsListResponse.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.journeys.JourneyListVersionsParams;
            import com.courier.models.journeys.JourneyVersionsListResponse;

            public final class Main {
                private Main() {}

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

                    JourneyVersionsListResponse journeyVersionsListResponse = client.journeys().listVersions("x");
                }
            }
        - lang: Ruby
          source: |-
            require "courier"

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

            journey_versions_list_response = courier.journeys.list_versions("x")

            puts(journey_versions_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 {
              $journeyVersionsListResponse = $client->journeys->listVersions('x');

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

            using TryCourier;

            using TryCourier.Models.Journeys;


            CourierClient client = new();


            JourneyListVersionsParams parameters = new() { TemplateID = "x" };


            var journeyVersionsListResponse = await
            client.Journeys.ListVersions(parameters);


            Console.WriteLine(journeyVersionsListResponse);
        - lang: CLI
          source: |-
            courier journeys list-versions \
              --api-key 'My API Key' \
              --template-id x
components:
  schemas:
    JourneyVersionsListResponse:
      description: Paged list of published journey versions, most recent first.
      type: object
      properties:
        results:
          type: array
          items:
            $ref: '#/components/schemas/JourneyVersionItem'
        paging:
          $ref: '#/components/schemas/Paging'
      required:
        - results
        - 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'
    JourneyVersionItem:
      description: A published version of a journey.
      type: object
      properties:
        version:
          type: string
        name:
          type: string
        created:
          nullable: true
          type: integer
          format: int64
        creator:
          type: string
          nullable: true
        published:
          nullable: true
          type: integer
          format: int64
      required:
        - version
        - name
        - created
        - creator
        - published
    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

````