---
updatedAt: 2025-11-13T14:14:34.000Z
agentTools:
  siteIndex: https://docs.affirm.com/llms.txt
  projectIndex: https://docs.affirm.com/developers/llms.txt
---

# Download File

Get a link to download a file by ID.

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "description": "Files API",
    "version": "0.0.1",
    "title": "Affirm Files API",
    "termsOfService": "https://www.affirm.com/terms",
    "contact": {
      "name": "Merchant Interfaces",
      "url": "https://coda.io/d/Merchant-Interfaces_d8L8vZX7Cbt",
      "email": "mint-eng@affirm.com"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    }
  },
  "servers": [
    {
      "url": "https://sandbox.affirm.com/api/v1/files"
    },
    {
      "url": "https://api.affirm.com/api/v1/files"
    }
  ],
  "paths": {
    "/{file_id}": {
      "get": {
        "tags": [
          "Files API"
        ],
        "summary": "Get file download link by ID.",
        "description": "Get a link to download a file by ID.",
        "x-openapi-router-controller": "affirm.partner_api.http.apis.files.v1.impl",
        "operationId": "get_file_download",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "description": "A unique identifier for file object.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          },
          {
            "name": "merchant_id",
            "in": "query",
            "description": "An optional value indicating the id of the Merchant.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileDownloadResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "403": {
            "description": "Not Authorized (Forbidden)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/NotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/UnauthorizedAccess"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "FileDownloadResponse": {
        "type": "object",
        "properties": {
          "file_id": {
            "type": "string",
            "description": "A unique identifier for file object."
          },
          "download_url": {
            "type": "string",
            "description": "A url used by client to download file."
          },
          "download_url_expires_at": {
            "type": "string",
            "description": "A time at which the file download link expires and is no longer available."
          }
        },
        "required": [
          "file_id",
          "download_url",
          "download_url_expires_at"
        ]
      },
      "InternalServerError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "internal_server_error"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human readable message with details about the error."
          }
        }
      },
      "UnauthorizedAccess": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "not_found"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human readable message with details about the error."
          }
        }
      },
      "UnauthorizedError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "api-key-pair-invalid",
              "unauthorized"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human readable message with details about the error."
          }
        }
      },
      "Forbidden": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "forbidden"
            ],
            "description": "Error Codes:\n  * `forbidden` - Corresponding File ID still pending virus scanning\n"
          },
          "message": {
            "type": "string",
            "description": "Human readable message with details about the error."
          }
        }
      },
      "NotFoundError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "file_not_found",
              "file_infected_error"
            ],
            "description": "Error Codes:\n  * `file_not_found` - Corresponding File ID not found.\n  * `file_infected_error`: Corresponding File ID leads to infected file that has been deleted.\n"
          },
          "message": {
            "type": "string",
            "description": "Human readable message with details about the error."
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```

# Sibling pages

* [Upload File](https://docs.affirm.com/developers/reference/create_file_upload-files-api.md)