Projects#

Projects group related translation phrases together.

Project Object#

{
  "_id": "507f1f77bcf86cd799439013",
  "name": "my-app",
  "organizationId": "507f1f77bcf86cd799439012",
  "defaultLocale": "en",
  "locales": ["en", "es", "fr", "de"],
  "paths": ["translations/%lang%.json"],
  "creationTime": "2024-01-15T10:00:00.000Z",
  "lastEditTime": "2024-01-15T10:00:00.000Z"
}

List Projects#

Retrieve all projects for the authenticated user's organization.

GET /api/projects

Authentication: Token required

Example#

curl https://api.multilocale.com/api/projects \
  -H "Authorization: Token <base64-token>"

Response#

[
  {
    "_id": "507f1f77bcf86cd799439013",
    "name": "my-app",
    "defaultLocale": "en",
    "locales": ["en", "es", "fr"]
  }
]

Get a Project#

Retrieve a project by its ID or name.

By ID#

GET /api/projects/:projectId

Authentication: None required

curl https://api.multilocale.com/api/projects/507f1f77bcf86cd799439013

By Name#

GET /api/projects/:projectName

Authentication: Optional (Token or organizationId query parameter)

# With authentication
curl https://api.multilocale.com/api/projects/my-app \
  -H "Authorization: Token <base64-token>"

# With organizationId
curl "https://api.multilocale.com/api/projects/my-app?organizationId=abc123"

Response#

{
  "_id": "507f1f77bcf86cd799439013",
  "name": "my-app",
  "organizationId": "507f1f77bcf86cd799439012",
  "defaultLocale": "en",
  "locales": ["en", "es", "fr"],
  "paths": ["translations/%lang%.json"]
}

Create a Project#

POST /api/projects

Authentication: Token required

Body#

{
  "name": "my-app",
  "defaultLocale": "en",
  "locales": ["en"],
  "paths": ["translations/%lang%.json"]
}

The organizationId is set automatically from the authenticated user.

Response#

Returns the created project object.

Update a Project#

PUT /api/projects/:projectId

Authentication: Token required

Body#

{
  "_id": "507f1f77bcf86cd799439013",
  "name": "my-app",
  "locales": ["en", "es", "fr", "de"],
  "paths": ["translations/%lang%.json", "src/i18n/%lang%.json"]
}

Response#

Returns the updated project object.