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

# Download File by ID

> Used to retrieve a specific file using its unique file identifier.

<br>

## Overview

<p>Use this endpoint to download files generated within the Xtremepush platform. This request returns a 302 redirect to a pre-signed S3 URL that expires after 5 minutes.</p>

<p>You can download exported segments or other platform-generated files using this endpoint.</p>

<p>The primary requirement for this request is the <code>fileId</code> path parameter. You must also include standard OAuth 2.0 authentication headers to access the endpoint.</p>

<br>

<p><strong>Prerequisites:</strong> You must use a valid OAuth 2.0 access token. The <strong>File Download</strong> scope must be enabled for your API Client ID. The requested file must belong to your authenticated project. If you attempt to access a file from a different project, the request returns a 403 Forbidden error.</p>

## OpenAPI

````json POST /file/{fileId}/download
{
  "openapi": "3.1.0",
  "info": {
    "title": "external-api",
    "version": "1"
  },
  "servers": [
    {
      "url": "https://api.eu.xtremepush.com/api/external"
    }
  ],
  "paths": {
    "/file/{fileId}/download": {
      "post": {
        "summary": "Download File by ID",
        "description": "Used to retrieve a specific file using its unique file identifier.\n\n<br>\n\n## Overview\n\n<p>Use this endpoint to download files generated within the Xtremepush platform. This request returns a 302 redirect to a pre-signed S3 URL that expires after 5 minutes.</p>\n\n<p>You can download exported segments or other platform-generated files using this endpoint.</p>\n\n<p>The primary requirement for this request is the <code>fileId</code> path parameter. You must also include standard OAuth 2.0 authentication headers to access the endpoint.</p>\n\n<br>\n\n<p><strong>Prerequisites:</strong> You must use a valid OAuth 2.0 access token. The <strong>File Download</strong> scope must be enabled for your API Client ID. The requested file must belong to your authenticated project. If you attempt to access a file from a different project, the request returns a 403 Forbidden error.</p>",
        "operationId": "download-file-by-id",
        "parameters": [
          {
            "in": "path",
            "name": "fileId",
            "required": "true",
            "schema": {
              "type": "string"
            },
            "description": "The unique identifier of the file to download"
          },
          {
            "in": "header",
            "name": "Authorization",
            "required": "true",
            "schema": {
              "type": "string"
            },
            "description": "The OAuth 2.0 bearer token. Example: Bearer {your_token}"
          }
        ],
        "responses": {
          "302": {
            "description": "The request is successful. The response includes a Location header containing the presigned S3 URL. This link is valid for 5 minutes."
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "default": "false"
                    },
                    "message": {
                      "type": "string",
                      "default": "oAuth authentication required"
                    }
                  }
                },
                "examples": {
                  "Result": {
                    "value": {
                      "success": "false",
                      "message": "oAuth authentication required"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "default": "Bad Request"
                    },
                    "message": {
                      "type": "string",
                      "default": "Access Denied"
                    }
                  }
                },
                "examples": {
                  "Result": {
                    "value": {
                      "name": "Bad Request",
                      "message": "Access Denied"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "default": "Not Found"
                    },
                    "message": {
                      "type": "string",
                      "default": "File Not Found"
                    }
                  }
                },
                "examples": {
                  "Result": {
                    "value": {
                      "name": "Not Found",
                      "message": "File Not Found"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "default": "Internal Server Error"
                    },
                    "message": {
                      "type": "string",
                      "default": "S3 not configured"
                    }
                  }
                },
                "examples": {
                  "Result": {
                    "value": {
                      "name": "Internal Server Error",
                      "message": "S3 not configured"
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "File Methods"
        ]
      }
    }
  }
}
````

