Skip to content
Docs menu

Download a file

Signed URL from an export/url task. No API key needed. The answer is the file or a 302 to a short-lived URL of the file.

GEThttps://api.switchfile.io/files/{fileId}/{filename}

No API key needed.

Example

curl -L "https://api.switchfile.io/files/2a6f8e1c-4b3d-4e7a-9c5f-8d1b0e2a4c67/report.pdf?expires=1762538401&signature=3f9c2a7d41e8b6c05d1f9e2a7b4c8d3e6f0a1b2c3d4e5f60718293a4b5c6d7e8" \
  -o report.pdf

Parameters

Path parameters

  • fileIdstring (uuid)required

    ID of the file

  • filenamestringrequired

    File name

Query parameters

  • expiresnumberrequired

    Part of the signed URL

    example: 1762538401

  • signaturestringrequired

    Part of the signed URL

    at least 1 characters · example: 3f9c2a7d41e8b6c05d1f9e2a7b4c8d3e6f0a1b2c3d4e5f60718293a4b5c6d7e8

  • inlinestring

    1: show the file in the browser instead of downloading it

    one of "1"

Responses

  • 200The file
  • 302Redirect to a short-lived URL of the file
  • 403The signature is wrong or the link has expired
    403 application/json
    {
      "message": "The download link has expired.",
      "code": "EXPIRED"
    }
  • 404The file was deleted
    404 application/json
    {
      "message": "File not found.",
      "code": "NOT_FOUND"
    }
  • 422Invalid data. errors names the fields
    422 application/json
    {
      "message": "id: Expected string to match 'uuid' format",
      "code": "INVALID_DATA",
      "errors": {
        "id": [
          "Expected string to match 'uuid' format"
        ]
      }
    }

Error bodies and codes are explained in Errors.