# Download a resource file

`GET https://api.lingohub.com/v1/{workspaceUrl}/projects/{projectUrl}/resources/{fileName}`

LingoHub API V1 · [Resources](https://developers.lingohub.com/reference/v1/operations/tags/resources.md) · operation `v1ResourceDownloadResourceFile`

Downloads the specified resource file from the project. Supports extensive export customization through query parameters including blank content handling, status filtering, character encoding, HTML encoding, and format conversion (e.g. export an iOS .strings file as Android XML). The response body contains the raw file content with appropriate content type headers. The response carries a weak ETag; send it back as If-None-Match to receive 304 Not Modified without a body while nothing in the project changed (If-Modified-Since alone is not evaluated: HTTP dates cannot tell two changes within one second apart). Send Accept-Encoding: gzip to receive the file compressed.

## Parameters

| Parameter | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `workspaceUrl` | path | yes | string | workspaceUrl |
| `projectUrl` | path | yes | string | projectUrl |
| `fileName` | path | yes | string | Name of the resource file to download |
| `path` | query | no | string | Path of the resource file to download. if the fileName won't be unique. |
| `iso2_slug` | query | no | string | The iso code of the resource file locale. Overrides the language information that might be given in the path. Alias of 'iso2_code'. |
| `iso2_code` | query | no | string | The iso code of the resource file locale. Overrides the language information that might be given in the path. Alias of 'iso2_slug'. |
| `source:blankContentHandling` | query | no | string |  |
| `target:blankContentHandling` | query | no | string |  |
| `source:filterByStatus` | query | no | string |  |
| `target:filterByStatus` | query | no | string |  |
| `htmlEncoding` | query | no | string |  |
| `encoding` | query | no | string | The character set encoding the file should have. |
| `escapeMode` | query | no | HtmlEncoding | Alias of 'htmlEncoding' |
| `addLocaleInformationToFilename` | query | no | string |  |
| `escapeCharacters` | query | no | boolean | If special characters should be escaped. Different behavior according to resource type. |
| `exportTargetComments` | query | no | boolean | Should comments be exported to files of the target language |
| `exportSourceLocale` | query | no | boolean | If a resource file holds multiple languages, this indicates if the source language should be included in this export. |
| `exportHeader` | query | no | boolean | If the file header (if applicable) should be exported. |
| `exportTitle` | query | no | boolean | if the title of a segment (if applicable) should be exported. |
| `exportDescription` | query | no | boolean | If a resource file holds multiple languages, this indicates if the description of the segments should be exported at all. |
| `projectType` | query | no | string | Overrides the project type of the project for this export. Enables to eg. download an iOS file as Android XML or vice versa. |
| `branch` | query | no | string | Name of the project branch. If omitted, the project's default branch is used. Returns 422 if the branch name does not exist in the project. |

## Example request

```sh
curl --request GET \
  --url https://api.lingohub.com/v1/WORKSPACE_URL/projects/PROJECT_URL/resources/FILE_NAME \
  --header 'Authorization: Bearer YOUR_API_KEY'
```

## Responses

- `200`: Successfully returns the content of the specified resource file as a byte stream.
- `304`: Not Modified: the If-None-Match validator still matches, the file the client holds is current.
- `401`: Unauthorized: Authentication credentials are missing or invalid.
- `403`: Forbidden: The authenticated user does not have resource view permission on this project.
- `404`: Not Found: The specified workspace, project, or resource file does not exist.
- `422`: Unprocessable Entity: The specified branch name does not exist in the project.
- `500`: Internal Server Error: An unexpected error occurred during resource file export.

## OpenAPI definition

The complete definition of this operation, with every schema it references:

````json
{
  "openapi": "3.1.0",
  "info": {
    "title": "LingoHub API V1",
    "version": "1"
  },
  "servers": [
    {
      "url": "https://api.lingohub.com",
      "description": "Generated server url"
    }
  ],
  "tags": [
    {
      "name": "Resources",
      "description": "Endpoints for the operations that can be performed on the resource files"
    }
  ],
  "paths": {
    "/v1/{workspaceUrl}/projects/{projectUrl}/resources/{fileName}": {
      "get": {
        "tags": [
          "Resources"
        ],
        "summary": "Download a resource file",
        "description": "Downloads the specified resource file from the project. Supports extensive export customization through query parameters including blank content handling, status filtering, character encoding, HTML encoding, and format conversion (e.g. export an iOS .strings file as Android XML). The response body contains the raw file content with appropriate content type headers. The response carries a weak ETag; send it back as If-None-Match to receive 304 Not Modified without a body while nothing in the project changed (If-Modified-Since alone is not evaluated: HTTP dates cannot tell two changes within one second apart). Send Accept-Encoding: gzip to receive the file compressed.",
        "operationId": "v1ResourceDownloadResourceFile",
        "parameters": [
          {
            "name": "workspaceUrl",
            "in": "path",
            "description": "workspaceUrl",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "projectUrl",
            "in": "path",
            "description": "projectUrl",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fileName",
            "in": "path",
            "description": "Name of the resource file to download",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "query",
            "description": "Path of the resource file to download. if the fileName won't be unique.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "iso2_slug",
            "in": "query",
            "description": "The iso code of the resource file locale. Overrides the language information that might be given in the path. Alias of 'iso2_code'.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "iso2_code",
            "in": "query",
            "description": "The iso code of the resource file locale. Overrides the language information that might be given in the path. Alias of 'iso2_slug'.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "source:blankContentHandling",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Should the segment be exported if source content is blank.",
              "enum": [
                "fallback",
                "use_source",
                "master_locale",
                "keep",
                "blank",
                "skip"
              ]
            }
          },
          {
            "name": "target:blankContentHandling",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Should the segment be exported if target content is blank.",
              "enum": [
                "fallback",
                "use_source",
                "master_locale",
                "keep",
                "blank",
                "skip"
              ]
            }
          },
          {
            "name": "source:filterByStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Filter for source segments based on status.",
              "enum": [
                "ALL",
                "TRANSLATED_AND_APPROVED",
                "TRANSLATED_AND_REVIEWED",
                "APPROVED",
                "REVIEWED"
              ]
            }
          },
          {
            "name": "target:filterByStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Filter for target segments based on status.",
              "enum": [
                "ALL",
                "TRANSLATED_AND_APPROVED",
                "TRANSLATED_AND_REVIEWED",
                "APPROVED",
                "REVIEWED"
              ]
            }
          },
          {
            "name": "htmlEncoding",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "If the segment content holds HTML. How should it be escaped",
              "enum": [
                "RAW",
                "ESCAPE",
                "CDATA"
              ]
            }
          },
          {
            "name": "encoding",
            "in": "query",
            "description": "The character set encoding the file should have.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "escapeMode",
            "in": "query",
            "description": "Alias of 'htmlEncoding'",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/HtmlEncoding"
            }
          },
          {
            "name": "addLocaleInformationToFilename",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "If the language information should be added to the filename.",
              "enum": [
                "ALL",
                "TARGETS",
                "NONE"
              ]
            }
          },
          {
            "name": "escapeCharacters",
            "in": "query",
            "description": "If special characters should be escaped. Different behavior according to resource type.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "exportTargetComments",
            "in": "query",
            "description": "Should comments be exported to files of the target language",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "exportSourceLocale",
            "in": "query",
            "description": "If a resource file holds multiple languages, this indicates if the source language should be included in this export.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "exportHeader",
            "in": "query",
            "description": "If the file header (if applicable) should be exported.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "exportTitle",
            "in": "query",
            "description": "if the title of a segment (if applicable) should be exported.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "exportDescription",
            "in": "query",
            "description": "If a resource file holds multiple languages, this indicates if the description of the segments should be exported at all.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "projectType",
            "in": "query",
            "description": "Overrides the project type of the project for this export. Enables to eg. download an iOS file as Android XML or vice versa.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ios.strings",
                "ios.stringsdict",
                "android.string.resources",
                "properties",
                "standard_json"
              ]
            }
          },
          {
            "name": "branch",
            "in": "query",
            "description": "Name of the project branch. If omitted, the project's default branch is used. Returns 422 if the branch name does not exist in the project.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully returns the content of the specified resource file as a byte stream.",
            "content": {
              "*/*": {
                "schema": {
                  "type": "string",
                  "format": "byte"
                }
              }
            }
          },
          "304": {
            "description": "Not Modified: the If-None-Match validator still matches, the file the client holds is current."
          },
          "401": {
            "description": "Unauthorized: Authentication credentials are missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorInfo"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: The authenticated user does not have resource view permission on this project.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorInfo"
                }
              }
            }
          },
          "404": {
            "description": "Not Found: The specified workspace, project, or resource file does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorInfo"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity: The specified branch name does not exist in the project.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorInfo"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred during resource file export.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorInfo"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "HtmlEncoding": {
        "type": "string",
        "enum": [
          "RAW",
          "ESCAPE",
          "CDATA"
        ]
      },
      "V1ErrorInfo": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "text": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "description": "API key authentication. Create API keys in your LingoHub workspace settings. Keys use the `lh-api_` prefix. Pass the full key as the Bearer token.",
        "scheme": "bearer"
      }
    }
  }
}
````
