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/acme-corp/projects/my-project/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

The URL slug of the workspace. The project links that GET /v1/projects returns contain it: /v1/{workspaceUrl}/projects/{projectUrl}.

Example

acme-corp
projectUrl
required
string

The URL slug of the project within its workspace. The project links that GET /v1/projects returns contain it: /v1/{workspaceUrl}/projects/{projectUrl}.

Example

my-project
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
error
object
code
string
description
string
status
string
Allowed values: 100 CONTINUE 101 SWITCHING_PROTOCOLS 102 PROCESSING 103 EARLY_HINTS 200 OK 201 CREATED 202 ACCEPTED 203 NON_AUTHORITATIVE_INFORMATION 204 NO_CONTENT 205 RESET_CONTENT 206 PARTIAL_CONTENT 207 MULTI_STATUS 208 ALREADY_REPORTED 226 IM_USED 300 MULTIPLE_CHOICES 301 MOVED_PERMANENTLY 302 FOUND 303 SEE_OTHER 304 NOT_MODIFIED 307 TEMPORARY_REDIRECT 308 PERMANENT_REDIRECT 400 BAD_REQUEST 401 UNAUTHORIZED 402 PAYMENT_REQUIRED 403 FORBIDDEN 404 NOT_FOUND 405 METHOD_NOT_ALLOWED 406 NOT_ACCEPTABLE 407 PROXY_AUTHENTICATION_REQUIRED 408 REQUEST_TIMEOUT 409 CONFLICT 410 GONE 411 LENGTH_REQUIRED 412 PRECONDITION_FAILED 413 CONTENT_TOO_LARGE 413 PAYLOAD_TOO_LARGE 414 URI_TOO_LONG 415 UNSUPPORTED_MEDIA_TYPE 416 REQUESTED_RANGE_NOT_SATISFIABLE 417 EXPECTATION_FAILED 418 I_AM_A_TEAPOT 421 MISDIRECTED_REQUEST 422 UNPROCESSABLE_CONTENT 422 UNPROCESSABLE_ENTITY 423 LOCKED 424 FAILED_DEPENDENCY 425 TOO_EARLY 426 UPGRADE_REQUIRED 428 PRECONDITION_REQUIRED 429 TOO_MANY_REQUESTS 431 REQUEST_HEADER_FIELDS_TOO_LARGE 451 UNAVAILABLE_FOR_LEGAL_REASONS 500 INTERNAL_SERVER_ERROR 501 NOT_IMPLEMENTED 502 BAD_GATEWAY 503 SERVICE_UNAVAILABLE 504 GATEWAY_TIMEOUT 505 HTTP_VERSION_NOT_SUPPORTED 506 VARIANT_ALSO_NEGOTIATES 507 INSUFFICIENT_STORAGE 508 LOOP_DETECTED 509 BANDWIDTH_LIMIT_EXCEEDED 510 NOT_EXTENDED 511 NETWORK_AUTHENTICATION_REQUIRED
validationErrors
Array<object>
object
field
string
errors
Array<object>
object
code
string
description
string
parameters
object
key
additional properties

Example

{
"error": {
"status": "100 CONTINUE"
}
}

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
message
required
string | null
items
required
Array<string> | null

Example generated

{
"message": "example",
"items": [
"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
string
Allowed values: 100 CONTINUE 101 SWITCHING_PROTOCOLS 102 PROCESSING 103 EARLY_HINTS 200 OK 201 CREATED 202 ACCEPTED 203 NON_AUTHORITATIVE_INFORMATION 204 NO_CONTENT 205 RESET_CONTENT 206 PARTIAL_CONTENT 207 MULTI_STATUS 208 ALREADY_REPORTED 226 IM_USED 300 MULTIPLE_CHOICES 301 MOVED_PERMANENTLY 302 FOUND 303 SEE_OTHER 304 NOT_MODIFIED 307 TEMPORARY_REDIRECT 308 PERMANENT_REDIRECT 400 BAD_REQUEST 401 UNAUTHORIZED 402 PAYMENT_REQUIRED 403 FORBIDDEN 404 NOT_FOUND 405 METHOD_NOT_ALLOWED 406 NOT_ACCEPTABLE 407 PROXY_AUTHENTICATION_REQUIRED 408 REQUEST_TIMEOUT 409 CONFLICT 410 GONE 411 LENGTH_REQUIRED 412 PRECONDITION_FAILED 413 CONTENT_TOO_LARGE 413 PAYLOAD_TOO_LARGE 414 URI_TOO_LONG 415 UNSUPPORTED_MEDIA_TYPE 416 REQUESTED_RANGE_NOT_SATISFIABLE 417 EXPECTATION_FAILED 418 I_AM_A_TEAPOT 421 MISDIRECTED_REQUEST 422 UNPROCESSABLE_CONTENT 422 UNPROCESSABLE_ENTITY 423 LOCKED 424 FAILED_DEPENDENCY 425 TOO_EARLY 426 UPGRADE_REQUIRED 428 PRECONDITION_REQUIRED 429 TOO_MANY_REQUESTS 431 REQUEST_HEADER_FIELDS_TOO_LARGE 451 UNAVAILABLE_FOR_LEGAL_REASONS 500 INTERNAL_SERVER_ERROR 501 NOT_IMPLEMENTED 502 BAD_GATEWAY 503 SERVICE_UNAVAILABLE 504 GATEWAY_TIMEOUT 505 HTTP_VERSION_NOT_SUPPORTED 506 VARIANT_ALSO_NEGOTIATES 507 INSUFFICIENT_STORAGE 508 LOOP_DETECTED 509 BANDWIDTH_LIMIT_EXCEEDED 510 NOT_EXTENDED 511 NETWORK_AUTHENTICATION_REQUIRED
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"
}