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

# Get invoice by ID

> Retrieve a single invoice by its unique identifier.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/account-billing/invoices.yml get /invoices/{id}
openapi: 3.1.0
info:
  title: Telnyx Invoices API
  version: 2.0.0
  description: API for Invoices.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /invoices/{id}:
    get:
      summary: Get invoice by ID
      description: Retrieve a single invoice by its unique identifier.
      operationId: GetInvoiceById
      parameters:
        - name: id
          in: path
          description: Invoice UUID
          required: true
          schema:
            type: string
            format: uuid
        - name: action
          in: query
          description: Invoice action
          required: false
          schema:
            type: string
            example: json
            enum:
              - json
              - link
      responses:
        '200':
          $ref: '#/components/responses/InvoiceDetailResponse'
        '400':
          $ref: '#/components/responses/BadRequestErrorResponse'
        '403':
          $ref: '#/components/responses/invoice_ForbiddenErrorResponse'
        '404':
          $ref: '#/components/responses/invoice_NotFoundErrorResponse'
        default:
          $ref: '#/components/responses/invoice_GenericErrorResponse'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Telnyx from 'telnyx';


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


            const invoice = await
            client.invoices.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');


            console.log(invoice.data);
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            invoice = client.invoices.retrieve(
                id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            )
            print(invoice.data)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tinvoice, err := client.Invoices.Get(\n\t\tcontext.TODO(),\n\t\t\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n\t\ttelnyx.InvoiceGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", invoice.Data)\n}\n"
        - lang: Java
          source: |-
            package com.telnyx.sdk.example;

            import com.telnyx.sdk.client.TelnyxClient;
            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
            import com.telnyx.sdk.models.invoices.InvoiceRetrieveParams;
            import com.telnyx.sdk.models.invoices.InvoiceRetrieveResponse;

            public final class Main {
                private Main() {}

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

                    InvoiceRetrieveResponse invoice = client.invoices().retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e");
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


            telnyx = Telnyx::Client.new(api_key: "My API Key")


            invoice =
            telnyx.invoices.retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")


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


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


            use Telnyx\Client;

            use Telnyx\Core\Exceptions\APIException;


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


            try {
              $invoice = $client->invoices->retrieve(
                '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', action: 'json'
              );

              var_dump($invoice);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx invoices retrieve \
              --api-key 'My API Key' \
              --id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e
components:
  responses:
    InvoiceDetailResponse:
      description: Get invoice details
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                $ref: '#/components/schemas/InvoiceDetail'
    BadRequestErrorResponse:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/invoice_Errors'
    invoice_ForbiddenErrorResponse:
      description: Insufficient permissions to access invoices
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/invoice_Errors'
    invoice_NotFoundErrorResponse:
      description: Invoice not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/invoice_Errors'
    invoice_GenericErrorResponse:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/invoice_Errors'
  schemas:
    InvoiceDetail:
      type: object
      properties:
        invoice_id:
          type: string
          format: uuid
          example: 48eff763-ea80-4345-b688-78249eb165a8
        file_id:
          type: string
          format: uuid
          example: 454ea3b0-9eaa-4fa9-992e-6d9f31c0a37e
        period_start:
          type: string
          format: date
          example: '2023-11-01'
        period_end:
          type: string
          format: date
          example: '2023-11-30'
        paid:
          type: boolean
          example: true
        url:
          type: string
          format: uri
          example: >-
            https://api.telnyx.com:443/v2/invoices/48eff763-ea80-4345-b688-78249eb165a8
        download_url:
          type: string
          format: uri
          description: Present only if the query parameter `action=link` is set.
          example: https://us-east-1.telnyxstorage.com/porting-documents/telnyx/...
    invoice_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/invoice_Error'
      type: object
    invoice_Error:
      required:
        - code
        - title
      properties:
        code:
          type: string
        title:
          type: string
        detail:
          type: string
        source:
          type: object
          properties:
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              type: string
            parameter:
              description: Indicates which query parameter caused the error.
              type: string
        meta:
          type: object
          additionalProperties: true
      type: object
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````