Skip to content

Batch Locations

POST /v2/tms-api/batch/locations

Create, update, or upsert multiple locations in a single request.

Analytics Optimization

Batch operations trigger analytics once for the entire batch, not per item.

API Reference

Request Body

Country/State format (ISO)

For location.country / location.state:

  • country: ISO 3166-1 alpha-2 (e.g., US, CA, MX)
  • state: ISO 3166-2 subdivision code (e.g., US-IL, CA-ON, MX-CMX)
  • if location.country is omitted, Mentium defaults to US
itemsarrayrequired
Array of location items. Each item must have: - `operation`: `create`, `update`, or `upsert` - `external_reference_id`: Location external reference ID - `location`: Location data object

Request Example

bash
curl -X POST "https://api.mentium.io/v2/tms-api/batch/locations" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "operation": "create",
        "external_reference_id": "LOC-CHICAGO-001",
        "location": {
          "external_reference_id": "LOC-CHICAGO-001",
          "name": "Chicago Distribution Center",
          "city": "Chicago",
          "state": "US-IL",
          "postal_code": "60601",
          "country": "US"
        }
      }
    ]
  }'

Response

json
{
  "success_count": 1,
  "error_count": 0,
  "results": [
    {
      "external_reference_id": "LOC-CHICAGO-001",
      "operation": "create",
      "success": true,
      "id": "loc_abc123"
    }
  ]
}

Mentium TMS API Documentation