Common Request Headers
Common Request Headers
YMS is a multi-tenant system. Each tenant may have multiple yards, and the finest level of data isolation is at the yard level. All API requests must include the following common headers to ensure proper tenant isolation and data handling.
Required Headers
Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer token obtained from the login API. Use the accessToken value from the login response. Example: Bearer eyJraWQi... |
X-Tenant-Id | Yes | Tenant identifier. Determines which tenant's data to access. Obtained from the login response userProfile.tenantId. |
X-Yard-Id | Yes | Yard identifier. The finest level of data isolation. A tenant may have multiple yards; this header specifies which yard's data to operate on. Obtained from the login response userProfile.yardList[].yardId. |
Item-Time-Zone | Yes | Timezone identifier (e.g., America/LosAngeles, Asia/Shanghai`). Used for time conversion between your local time and the system's stored timestamps. |
How to Obtain These Values
Step 1: Login
Call the login API to obtain your access token and user profile:
Request Body:
Response (key fields):
Step 2: Extract Header Values
From the login response, extract:
Authorization: Bearer + data.accessToken
X-Tenant-Id: data.userProfile.tenantId
X-Yard-Id: Choose from data.userProfile.yardList[].yardId (or use data.userProfile.defaultYardId)
Item-Time-Zone: Use the timezone value from the corresponding yard in data.userProfile.yardList[]
Example Request
Timezone Handling
YMS stores all time values as timestamps (epoch milliseconds) in the database. The Item-Time-Zone header controls how times are interpreted:
On write: Time values in your request (e.g., 2026-05-24T23:50:21) are interpreted in the timezone specified by Item-Time-Zone and converted to a timestamp for storage.
On read: Stored timestamps are converted back to the timezone specified by Item-Time-Zone before being returned in the response.
Time format: All time fields in requests and responses use the format yyyy-MM-ddTHH:mm:ss (e.g., 2026-05-24T23:50:21).
Important: Always pass the correct timezone for the yard you are operating on. Using an incorrect timezone will result in time values being shifted. Each yard's timezone is available in the login response under yardList[].timezone.
Data Isolation Model
Each API request operates within the scope of a single yard. Data from one yard is not accessible when querying another yard. Ensure you set X-Yard-Id to the correct yard for your operation.