sandbox
1 thao tác
POST /v1/sandbox/accountsCreate a sandbox account (hosted sandbox only)
POST /v1/sandbox/accounts
Create a sandbox account (hosted sandbox only)
Không cần xác thực · createSandboxAccount
The hosted sandbox only (#218, x-sandbox-only): on every other deployment, CropPath's live service included, this path answers 404 no_such_route for every method, exactly like an unknown path, and creates nothing.
Anonymous: no session and no token. Creates a fresh company of its own (tenant_id, sbx- and 16 random characters) and returns, once, an API token for it (api_token, agt_...): role tenant_admin of that company only, valid 24 hours (expires_at, Unix seconds). Send it as Authorization: Bearer to base_url (the sandbox's address); it never reaches another company (404, like a missing record) or a platform operation (403). Within a few minutes the company holds the demo scenario: a packing house, a growing area and its grower, devices, a lot of 128 measured fruits with its lab results, packing, seal and shipment, as on the man1 and man2 mockups. The company and all its data are deleted 7 days after its creation (the sandbox's setting); no email is ever sent; webhooks refuse private and loopback addresses as everywhere.
Limits: a client address creates at most 5 companies an hour (the sandbox's setting; the address is the CF-Connecting-IP a trusted proxy sends, else the socket peer), then 429 with Retry-After before anything is done; and the sandbox holds at most 500 live companies (its setting), then 503 sandbox_full. The body is empty or {}. Audited (sandbox.account.create, actor system:sandbox, in the creation's transaction: the company and the token's expiry, never the token). Every answer is no-store.
Nội dung yêu cầu
SandboxAccountCreate (không bắt buộc)
Kiểu nội dung: application/json
Ví dụ yêu cầu · application/json
{}Phản hồi
| Mã trạng thái | Kiểu | Mô tả |
|---|---|---|
| 201 | SandboxAccountapplication/json | The new company and its API token, shown this once. |
| 400 | Errorapplication/json | A body that is not empty or |
| 404 | Errorapplication/json | Not the hosted sandbox: on every other deployment the path does not exist ( |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 413 | Errorapplication/json | The request body is over 1 MiB. |
| 429 | Errorapplication/json | Too many sandbox accounts from this client address (5 an hour unless the sandbox sets another limit). Nothing was done, and no audit row is written; retry after |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
| 503 | Errorapplication/json | The sandbox holds as many live companies as it may (500 unless it sets another cap): nothing is created; retry later. Companies are deleted 7 days after their creation, which frees places. |
Header của phản hồi
| Tên | Mã trạng thái | Kiểu | Mô tả |
|---|---|---|---|
X-Request-Id | 201 | string | Request id: the caller's |
Cache-Control | 201 | string |
|
X-Request-Id | 400 | string | Request id: the caller's |
Cache-Control | 400 | string |
|
X-Request-Id | 404 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 413 | string | Request id: the caller's |
X-Request-Id | 429 | string | Request id: the caller's |
Cache-Control | 429 | string |
|
Retry-After | 429 | string | Seconds to wait before retrying. |
X-Request-Id | 500 | string | Request id: the caller's |
X-Request-Id | 503 | string | Request id: the caller's |
Cache-Control | 503 | string |
|
Retry-After | 503 | string | Seconds to wait before retrying. |
Ví dụ phản hồi
Phản hồi 201 · application/json
{
"tenant_id": "sbx-k3m7q2xw5zr4tn6p",
"api_token": "agt_Q2hhbmdlIG1lIG5vdzogdGhpcyBpcyBhbiBleGFtcGx",
"expires_at": 1790086400.5,
"base_url": "https://sandbox-txng.theio.vn"
}Phản hồi 400 · application/json · invalid_json
{
"error": "invalid JSON",
"code": "invalid_json"
}Phản hồi 400 · application/json · not_an_object
{
"error": "expected a JSON object",
"code": "expected_a_json_object"
}Phản hồi 400 · application/json · unknown
{
"error": "unknown fields: tenant_id",
"code": "unknown_fields"
}Phản hồi 400 · application/json · bad_request_id
{
"error": "bad request id",
"code": "bad_request_id"
}Phản hồi 404 · application/json
{
"error": "no such route",
"code": "no_such_route"
}Phản hồi 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Phản hồi 413 · application/json
{
"error": "body too large",
"code": "body_too_large"
}Phản hồi 429 · application/json
{
"error": "too many requests",
"code": "too_many_requests"
}Phản hồi 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}Phản hồi 503 · application/json
{
"error": "sandbox full: the sandbox holds as many companies as it may; try again later",
"code": "sandbox_full"
}