Skip to content

API V1 · Resources

Upload a resource file

POST
/v1/{workspaceUrl}/projects/{projectUrl}/resources
curl --request POST \
--url https://api.lingohub.com/v1/WORKSPACE_URL/projects/PROJECT_URL/resources \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: multipart/form-data' \
--form file=@translations.json

Uploads a single resource file to the specified project. The file’s language is detected automatically from the file name, or can be explicitly set via the iso2_slug/iso2_code parameter. Import behavior for source and target languages (create new segments, update existing, deactivate missing) can be controlled through optional parameters. If the upload might cause a file name collision, set force=true to proceed.

workspaceUrl
required
string

WorkspaceUrl

projectUrl
required
string

ProjectUrl

path
string

Path the resource container (file) will be uploaded to

iso2_slug
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
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:createNew
boolean

If this file belongs to the source language: If new segments should be created

source:updateExisting
boolean

If this file belongs to the source language: If changed segments should be updated

source:deactivateMissing
boolean

If this file belongs to the source language: If removed segments should be deactivated

target:createNew
boolean

If this file belongs to the target language: If new segments should be created

target:updateExisting
boolean

If this file belongs to the target language: If changed segments should be updated

target:deactivateMissing
boolean

If this file belongs to the target language: If removed segments should be deactivated

force
boolean

Force the upload. Override potential security measures, eg. a collision between file names

branch
string

Name of the project branch to import into. If omitted, the project’s default branch is used. Returns 422 if the branch name does not exist in the project.

Media typemultipart/form-data
object
file
required

File that will be uploaded

string format: binary

Successfully uploaded the resource file.

Media typeapplication/json

Examples

ExampleuploadSuccess

Successful upload

UploadSuccess

{
"status": "Success"
}

Unauthorized: Authentication credentials are missing or invalid.

Media typeapplication/json
object
url
string
message
string
text
string

Example generated

{
"url": "example",
"message": "example",
"text": "example"
}

Forbidden: The authenticated user does not have resource management permission on this project.

Media typeapplication/json
object
url
string
message
string
text
string

Example generated

{
"url": "example",
"message": "example",
"text": "example"
}

Not Found: The specified workspace or project does not exist.

Media typeapplication/json
object
url
string
message
string
text
string

Example generated

{
"url": "example",
"message": "example",
"text": "example"
}

Not Acceptable: A file name collision was detected and force=true was not set. Specify a path or use force=true to override.

Media typeapplication/json

Examples

ExamplecollisionDetected

Path collision detected

CollisionDetected

{
"status": "Not acceptable",
"message": "A situation has been detected that might lead to an unwanted upload action..."
}

Unprocessable Entity: The specified branch name does not exist in the project, or the file has an extension the project type cannot import (error code files.invalid_extension, naming the file).

Media typeapplication/json
object
error
object
code
string
description
string
status
object
error
boolean
is4xxClientError
boolean
is5xxServerError
boolean
is1xxInformational
boolean
is2xxSuccessful
boolean
is3xxRedirection
boolean
validationErrors
Array<object>
object
field
string
errors
Array<object>
object
code
string
description
string
parameters
object
key
additional properties

Examples

ExampleunsupportedFile

Unsupported file extension

UnsupportedFile

{
"validationErrors": [
{
"field": "files",
"errors": [
{
"code": "files.invalid_extension",
"description": "File 'Resources.en.txt' has an unsupported extension; this project imports: resx, resw.",
"parameters": {
"file": "Resources.en.txt"
}
}
]
}
]
}

Internal Server Error: An unexpected error occurred during the import process.

Media typeapplication/json
object
url
string
message
string
text
string

Example generated

{
"url": "example",
"message": "example",
"text": "example"
}