Add File

Add new file to Crowdin project.

Request

POST https://api.crowdin.com/api/project/{project-identifier}/add-file?key={project-key}

Parameters

Name Value Description
filesrequired array Files array that should be added to Crowdin project. Array keys should contain file names with path in Crowdin project.
Note! 20 files max are allowed to upload per one time file transfer. The maximum size of one file is 100 MB.
titlesoptional array An arrays of strings that defines titles for uploaded files. Array keys should contain file names with path in Crowdin project.
export_patternsoptional array An arrays of strings that defines names of resulted files (translated files in resulted archive). Array keys should contain file names with path in Crowdin project.
typeoptional string Acceptable values are:
  • empty value or "auto" — Try to detect file type by extension or MIME type
  • "gettext" — GNU GetText (*.po, *.pot)
  • "qtts" — Nokia Qt (*.ts)
  • "dklang" — Delphi DKLang (*.dklang)
  • "android" — Android (*.xml)
  • "resx" — .NET (*.resx)
  • "properties" — Java (*.properties)
  • "macosx" — Mac OS X / iOS (*.strings)
  • "blackberry" — BlackBerry (*.rrc)
  • "Symbian" — Symbian (*.lXX)
  • "flex" — Adobe Flex (*.properties)
  • "bada" — Samsung Bada (*.xml)
  • "txt" — Plain Text (*.txt)
  • "srt" — SubRip .srt (*.srt)
  • "sbv" — Youtube .sbv (*.sbv)
  • "xliff" — XLIFF (*.xliff)
  • "html" — HTML (*.html, *.htm, *.xhtml, *.xhtm)
  • "dtd" — Mozilla DTD (*.dtd)
  • "chrome" — Google Chrome Extension (*.json)
  • "yaml" — Ruby On Rails (*.yaml)
  • "csv" — Comma Separated Values (*.csv)
  • "rc" — Windows Resources (*.rc)
  • "wxl" — WiX Installer Resources (*.wxl)
  • "nsh" — NSIS Installer Resources (*.nsh)
  • "joomla" — Joomla localizable resources (*.ini)
  • "ini" — Generic INI (*.ini)
  • "isl" — ISL (*.isl)
  • "resw" — Windows 8 Metro (*.resw)
  • "resjson" — Windows 8 Metro (*.resjson)
  • "docx" — Microsoft Office and OpenOffice.org Documents (*.docx, *.dotx, *.odt, *.ott, *.xslx, *.xltx, *.pptx, *.potx, *.ods, *.ots, *.odg, *.otg, *.odp, *.otp, *.idml)
  • "md" — Markdown (*.md, *.text, *.markdown...)
  • "mediawiki" — MediaWiki (*.wiki, *.wikitext, *.mediawiki)
  • "play" — Play Framework
  • "haml" — Haml (*.haml)
  • "arb" — Application Resource Bundle (*.arb)
  • "vtt" — Video Subtitling and WebVTT (*.vtt)
first_line_contains_headerCSV and XLS/XLSX files only
optional
string Used when uploading CSV (or XLS/XLSX) files via API. Defines whether first line should be imported or it contains columns headers. May not contain value.
schemeCSV and XLS/XLSX files only
required
string Note: Used only when uploading CSV (or XLS/XLSX) file to define data columns mapping.
Acceptable value is the combination of the following constants:
  • "identifier" — Column contains string identifier.
  • "source_phrase" — Column contains only source string (in result string will contain same string).
  • "source_or_translation" — Column contains source string but when exporting same column should contain translation (also when uploading existing translations, the value from this column will be used as a translated string).
  • "translation" — Column contains translated string (when imported file already contains translations).
  • "context" — Column contains some comments on source string. Context information.
  • "max_length" — Column contains max. length of translation for this string.
  • "none" — Do not import column.
Example parameter you will have to add: &scheme=identifier,source_or_translation

Note: for exported file to contain translations to all the target languages, specify language codes in scheme (e.g. &scheme=identifier,source_phrase,uk,ru,fr).
branchoptional string The name of related version branch (Versions Management).
jsonoptional string May not contain value. Defines that response should be in JSON format.
jsonpoptional string Callback function name. Defines that response should be in JSONP format.
translate_contentXML files only
optional
bool Defines whether to translate texts placed inside the tags. Acceptable values are: 0 or 1. Default is 1.
translate_attributesXML files only
optional
bool Defines whether to translate tags attributes. Acceptable values are: 0 or 1. Default is 1.
content_segmentationXML files only
optional
bool Defines whether to split long texts into smaller text segments. Acceptable values are: 0 or 1. Default is 1.
Important! This option disables the possibility to upload existing translations for XML files when enabled.
translatable_elementsXML files only
optional
array This is an array of strings, where each item is the XPaths to DOM element that should be imported.
Acceptable values are:
  • /path/to/node
  • /path/to/attribute[@attr]
  • //node , node - import each node named "node"
  • //[@attr] - import сontent of each attribute named "attr"
  • nodeone/nodetwo - import all "nodetwo" nodes (root node is not required to be specified)
  • /nodeone//nodetwo - import all "nodetwo" nodes ignoring other nodes between "nodeone" and "nodetwo"
  • //node[@attr] - import content of attributes "attr" stored in nodes named "node"

Note! If defined, the parameters "translate_content" and "translate_attributes" are not taken into account while importing.
escape_quotesproperties files only
optional
integer Defines whether single quote should be escaped by another single quote or backslash in exported translations. Acceptable values are: 0, 1, 2, 3. Default is 3.

0 — Do not escape single quote;
1 — Escape single quote by another single quote;
2 — Escape single quote by backslash;
3 — Escape single quote by another single quote only in strings containing variables ( {0} )
Variables
project-identifierrequired string Should contain the project identifier.
project-keyrequired string Project API key.

Response

If the method is successful it responds with an XML structure, as it is shown below.
<?xml version="1.0" encoding="ISO-8859-1"?>

  
    
      strings.xml
      4
      11
    
  


Unsuccessful response sample:
<?xml version="1.0" encoding="ISO-8859-1"?>

  3
  API key is not valid


Examples

curl \
  -F "type=android" \
  -F "files[/directory/arrays.xml]=@arrays.xml" \
  -F "files[strings.xml]=@strings.xml" \
  https://api.crowdin.com/api/project/{project-identifier}/add-file?key={project-key}

curl \
  -F "type=csv" \
  -F "files[directory/multilingual.csv]=@example.csv" \
  -F "export_patterns[directory/multilingual.csv]=/%locale%/%original_file_name%" \
  -F "titles[directory/multilingual.csv]=Title in Crowdin Project" \
  -F "scheme=identifier,source_phrase,translation" \
  -F "first_line_contains_header=true" \
  https://api.crowdin.com/api/project/{project-identifier}/add-file?key={project-key}