> ## 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.

# Generate a temporary download link for a document

> Generates a temporary pre-signed URL that can be used to download the document directly from the storage backend without authentication.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/numbers-identity/documents.yml get /documents/{id}/download_link
openapi: 3.1.0
info:
  title: Telnyx Documents API
  version: 2.0.0
  description: API for Documents.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /documents/{id}/download_link:
    get:
      tags:
        - Documents
      summary: Generate a temporary download link for a document
      description: >-
        Generates a temporary pre-signed URL that can be used to download the
        document directly from the storage backend without authentication.
      operationId: getDocumentDownloadLink
      parameters:
        - name: id
          in: path
          required: true
          description: Uniquely identifies the document
          schema:
            type: string
            format: uuid
            example: 550e8400-e29b-41d4-a716-446655440000
      responses:
        '200':
          description: Successfully generated download link
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    required:
                      - url
                    properties:
                      url:
                        type: string
                        format: uri
                        description: Pre-signed temporary URL for downloading the document
                        example: >-
                          https://s3.amazonaws.com/bucket/path/to/document?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...
        '404':
          $ref: '#/components/responses/ResourceNotFound'
        '422':
          $ref: '#/components/responses/documents_UnprocessableEntity'
        default:
          $ref: '#/components/responses/documents_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 response = await client.documents.generateDownloadLink(
              '550e8400-e29b-41d4-a716-446655440000',
            );

            console.log(response.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
            )
            response = client.documents.generate_download_link(
                "550e8400-e29b-41d4-a716-446655440000",
            )
            print(response.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\tresponse, err := client.Documents.GenerateDownloadLink(context.TODO(), \"550e8400-e29b-41d4-a716-446655440000\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.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.documents.DocumentGenerateDownloadLinkParams;

            import
            com.telnyx.sdk.models.documents.DocumentGenerateDownloadLinkResponse;


            public final class Main {
                private Main() {}

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

                    DocumentGenerateDownloadLinkResponse response = client.documents().generateDownloadLink("550e8400-e29b-41d4-a716-446655440000");
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


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


            response =
            telnyx.documents.generate_download_link("550e8400-e29b-41d4-a716-446655440000")


            puts(response)
        - 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 {
              $response = $client->documents->generateDownloadLink(
                '550e8400-e29b-41d4-a716-446655440000'
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx documents generate-download-link \
              --api-key 'My API Key' \
              --id 550e8400-e29b-41d4-a716-446655440000
components:
  responses:
    ResourceNotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/documents_Error'
    documents_UnprocessableEntity:
      description: Unprocessable entity. Check the 'detail' field in response for details.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/documents_Errors'
    documents_GenericErrorResponse:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/documents_Errors'
  schemas:
    documents_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
    documents_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/documents_Error'
      type: object
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````