curl --request POST \
--url https://api-staging.mystacks.ai/manager/stacks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"name": "Example stack",
"allocation": [
{
"token_address": "0x117cc2133c37b721f49de2a7a74833232b3b4c0c",
"weight_bps": 6000
},
{
"token_address": "0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec",
"weight_bps": 4000
}
],
"schedule": {
"preset": "daily"
}
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Example stack',
allocation: [
{token_address: '0x117cc2133c37b721f49de2a7a74833232b3b4c0c', weight_bps: 6000},
{token_address: '0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec', weight_bps: 4000}
],
schedule: {preset: 'daily'}
})
};
fetch('https://api-staging.mystacks.ai/manager/stacks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api-staging.mystacks.ai/manager/stacks"
payload = {
"name": "Example stack",
"allocation": [
{
"token_address": "0x117cc2133c37b721f49de2a7a74833232b3b4c0c",
"weight_bps": 6000
},
{
"token_address": "0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec",
"weight_bps": 4000
}
],
"schedule": { "preset": "daily" }
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "bf4bc5e9-0d9e-454c-bc1c-30abc120b074",
"current_revision_id": "e137435f-83ce-4b3c-86ae-75d6462487b6",
"name": "Example stack",
"allocation": [
{
"token_address": "0x117cc2133c37b721f49de2a7a74833232b3b4c0c",
"weight_bps": 6000
},
{
"token_address": "0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec",
"weight_bps": 4000
}
],
"schedule": {
"preset": "daily"
}
}{
"id": "bf4bc5e9-0d9e-454c-bc1c-30abc120b074",
"current_revision_id": "e137435f-83ce-4b3c-86ae-75d6462487b6",
"name": "Example stack",
"allocation": [
{
"token_address": "0x117cc2133c37b721f49de2a7a74833232b3b4c0c",
"weight_bps": 6000
},
{
"token_address": "0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec",
"weight_bps": 4000
}
],
"schedule": {
"preset": "daily"
}
}{
"code": "invalid_request",
"message": "invalid request body",
"request_id": "d28e1ad4-2ca8-4f35-b590-8bf3b53abc81"
}{
"code": "unauthorized",
"message": "invalid manager credential",
"request_id": "d28e1ad4-2ca8-4f35-b590-8bf3b53abc81"
}{
"code": "conflict",
"message": "Idempotency-Key was already used with different input",
"request_id": "d28e1ad4-2ca8-4f35-b590-8bf3b53abc81"
}{
"code": "payload_too_large",
"message": "request body exceeds 262144 bytes",
"request_id": "d28e1ad4-2ca8-4f35-b590-8bf3b53abc81"
}{
"code": "rate_limited",
"message": "manager verification rate limited",
"request_id": "d28e1ad4-2ca8-4f35-b590-8bf3b53abc81"
}{
"code": "internal_error",
"message": "an unexpected error occurred",
"request_id": "d28e1ad4-2ca8-4f35-b590-8bf3b53abc81"
}{
"code": "service_unavailable",
"message": "manager verification is unavailable",
"request_id": "d28e1ad4-2ca8-4f35-b590-8bf3b53abc81"
}Create a stack
Create and immediately publish a stack.
curl --request POST \
--url https://api-staging.mystacks.ai/manager/stacks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"name": "Example stack",
"allocation": [
{
"token_address": "0x117cc2133c37b721f49de2a7a74833232b3b4c0c",
"weight_bps": 6000
},
{
"token_address": "0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec",
"weight_bps": 4000
}
],
"schedule": {
"preset": "daily"
}
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Example stack',
allocation: [
{token_address: '0x117cc2133c37b721f49de2a7a74833232b3b4c0c', weight_bps: 6000},
{token_address: '0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec', weight_bps: 4000}
],
schedule: {preset: 'daily'}
})
};
fetch('https://api-staging.mystacks.ai/manager/stacks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api-staging.mystacks.ai/manager/stacks"
payload = {
"name": "Example stack",
"allocation": [
{
"token_address": "0x117cc2133c37b721f49de2a7a74833232b3b4c0c",
"weight_bps": 6000
},
{
"token_address": "0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec",
"weight_bps": 4000
}
],
"schedule": { "preset": "daily" }
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "bf4bc5e9-0d9e-454c-bc1c-30abc120b074",
"current_revision_id": "e137435f-83ce-4b3c-86ae-75d6462487b6",
"name": "Example stack",
"allocation": [
{
"token_address": "0x117cc2133c37b721f49de2a7a74833232b3b4c0c",
"weight_bps": 6000
},
{
"token_address": "0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec",
"weight_bps": 4000
}
],
"schedule": {
"preset": "daily"
}
}{
"id": "bf4bc5e9-0d9e-454c-bc1c-30abc120b074",
"current_revision_id": "e137435f-83ce-4b3c-86ae-75d6462487b6",
"name": "Example stack",
"allocation": [
{
"token_address": "0x117cc2133c37b721f49de2a7a74833232b3b4c0c",
"weight_bps": 6000
},
{
"token_address": "0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec",
"weight_bps": 4000
}
],
"schedule": {
"preset": "daily"
}
}{
"code": "invalid_request",
"message": "invalid request body",
"request_id": "d28e1ad4-2ca8-4f35-b590-8bf3b53abc81"
}{
"code": "unauthorized",
"message": "invalid manager credential",
"request_id": "d28e1ad4-2ca8-4f35-b590-8bf3b53abc81"
}{
"code": "conflict",
"message": "Idempotency-Key was already used with different input",
"request_id": "d28e1ad4-2ca8-4f35-b590-8bf3b53abc81"
}{
"code": "payload_too_large",
"message": "request body exceeds 262144 bytes",
"request_id": "d28e1ad4-2ca8-4f35-b590-8bf3b53abc81"
}{
"code": "rate_limited",
"message": "manager verification rate limited",
"request_id": "d28e1ad4-2ca8-4f35-b590-8bf3b53abc81"
}{
"code": "internal_error",
"message": "an unexpected error occurred",
"request_id": "d28e1ad4-2ca8-4f35-b590-8bf3b53abc81"
}{
"code": "service_unavailable",
"message": "manager verification is unavailable",
"request_id": "d28e1ad4-2ca8-4f35-b590-8bf3b53abc81"
}Idempotency
Idempotency-Key must contain non-whitespace text.
Keys are scoped to your manager account and stack creation.
Accepted keys do not expire automatically.
A retry with the same key and equivalent original input returns the same stack ID.
It returns that stack’s current configuration and ETag.
If the stack has been updated, this can differ from the first creation response.
The retry does not revert changes or create a revision.
The following differences do not change creation input identity:
- JSON whitespace and object-field order.
- Allocation-entry order.
- Token-address capitalization that still passes address validation.
409 conflict.
Use update a stack to change an existing stack.
When matching requests arrive together, the first successfully saved creation establishes the result.
There is no fixed application limit on key length.
A key that exceeds supported storage size returns 400 invalid_request without creating a stack.
A UUID is a practical creation key.
Errors
| Status | Code | Cause |
|---|---|---|
400 | invalid_request | Missing or blank creation key, unsupported key size, malformed JSON, or invalid configuration. |
409 | conflict | The creation key was already used with different input. |
Authorizations
Enter the API key supplied by MyStacks. The playground adds the Authorization: Bearer prefix for you.
Headers
Required for creation. Must contain non-whitespace text. Reuse the exact same manager-scoped key and original input after an uncertain result. Keys do not expire automatically. No fixed application length cap applies. A key beyond the database receipt index storage limit returns 400 and rolls back the complete creation.
1\SOptional request trace ID. A nonempty value is echoed in the response. Missing or empty values cause a UUID to be generated.
Body
Complete stack configuration. Unknown fields are rejected in the body and nested objects. The request body must not exceed 262144 bytes.
Must contain non-whitespace text and must not contain U+0000. Accepted names retain their exact whitespace. No separate name-length limit applies within the body size limit.
1^(?![\s\S]*\u0000)[\s\S]*\S[\s\S]*$"Example stack"
The complete target allocation. Weights must total exactly 10000. Duplicate token identities are rejected after lowercase normalization. When supplied in PATCH, this list replaces the full saved allocation. Omitted tokens are removed.
1 - 30 elementsShow child attributes
Show child attributes
[
{
"token_address": "0x117cc2133c37b721f49de2a7a74833232b3b4c0c",
"weight_bps": 6000
},
{
"token_address": "0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec",
"weight_bps": 4000
}
]
Schedule configuration only. Saving a preset does not execute trades.
Show child attributes
Show child attributes
{ "preset": "daily" }
Response
Identical creation retry. Returns the original stack ID with its current complete configuration and revision.
Current complete configuration. No subscriber, balance, performance, or execution data is included.
Stable stack identifier.
"bf4bc5e9-0d9e-454c-bc1c-30abc120b074"
Identifier of this complete saved configuration revision.
"e137435f-83ce-4b3c-86ae-75d6462487b6"
Must contain non-whitespace text and must not contain U+0000. Accepted names retain their exact whitespace. No separate name-length limit applies within the body size limit.
1^(?![\s\S]*\u0000)[\s\S]*\S[\s\S]*$"Example stack"
Complete saved allocation. Addresses are lowercase, unique, and ordered by token address. Weights total exactly 10000.
1 - 30 elementsShow child attributes
Show child attributes
[
{
"token_address": "0x117cc2133c37b721f49de2a7a74833232b3b4c0c",
"weight_bps": 6000
},
{
"token_address": "0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec",
"weight_bps": 4000
}
]
Schedule configuration only. Saving a preset does not execute trades.
Show child attributes
Show child attributes
{ "preset": "daily" }