Skip to main content
POST
/
admin
/
translations
/
batch
JS SDK
import Medusa from "@medusajs/js-sdk"

export const sdk = new Medusa({
  baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
  debug: import.meta.env.DEV,
  auth: {
    type: "session",
  },
})

sdk.admin.translation.batch({
  create: [
    {
      reference_id: "prod_123",
      reference: "product",
      locale_code: "en-US",
      translations: { title: "Shirt" }
    }
  ],
  update: [
    {
      id: "trans_123",
      translations: { title: "Pants" }
    }
  ],
  delete: ["trans_321"]
})
.then(({ created, updated, deleted }) => {
  console.log(created, updated, deleted)
})
```
{
  "created": [
    {
      "id": "<string>",
      "reference_id": "prod_123",
      "reference": "product",
      "locale_code": "fr-FR",
      "translations": {
        "title": "Chaussures",
        "description": "Des chaussures élégantes."
      },
      "created_at": "2023-11-07T05:31:56Z",
      "updated_at": "2023-11-07T05:31:56Z",
      "deleted_at": "2023-11-07T05:31:56Z"
    }
  ],
  "updated": [
    {
      "id": "<string>",
      "reference_id": "prod_123",
      "reference": "product",
      "locale_code": "fr-FR",
      "translations": {
        "title": "Chaussures",
        "description": "Des chaussures élégantes."
      },
      "created_at": "2023-11-07T05:31:56Z",
      "updated_at": "2023-11-07T05:31:56Z",
      "deleted_at": "2023-11-07T05:31:56Z"
    }
  ],
  "deleted": {
    "ids": [
      "<string>"
    ],
    "object": "translation",
    "deleted": true
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

The translations to be created, updated, or deleted in bulk.

create
object[]

The translations to create.

update
object[]

The translations to update.

delete
string[]

The translations to delete.

The ID of a translation to delete.

Response

OK

The batch response for managing translations.

created
object[]
required

The created translations.

updated
object[]
required

The updated translations.

deleted
object
required

Summary of the deleted translations.