Skip to documentation
Weavers Docs

Pages and endpoints

Tab to navigate · Enter to openEsc to close

POST /api/broker/orders

Account required · HTTP API reference

All endpoints · Authentication and retries · Download OpenAPI

  • Requires a signed-in account and permission to access this resource. Use identifiers returned by your own account's earlier requests.
  • Requires a connected paper-trading account. Only whole-share quantities are supported; live environments are rejected. Read broker status and verify the symbol, side and quantity before submitting.
  • Protected writes require an allowed Origin, the CSRF cookie and matching X-CSRF-Token header.
  • Send a fresh X-Request-Nonce and current X-Request-Timestamp on every attempt. Reuse an idempotency key only for the same logical action.

Request

ParameterLocationType and requirement
x-idempotency-keyheaderstring · required

Pattern: ^[A-Za-z0-9_-]{8,128}$

X-Request-Nonceheaderstring · required

Generate a fresh nonce for every attempt.

Pattern: ^[A-Za-z0-9_-]{16,128}$

X-Request-Timestampheaderstring · required

Current Unix seconds (10 digits) or milliseconds (13 digits).

Pattern: ^(?:[0-9]{10}|[0-9]{13})$

Originheaderstring · required

An origin allowed by this deployment.

X-CSRF-Tokenheaderstring · required

Must match the CSRF cookie issued to this browser.

Body · application/json

providerId optional · string
symbol required · string
side required · "buy" | "sell"
qty required · integer | string
View qty model
Variant 1: integer

integer

Variant 2: string

string — Must parse to a positive whole-share quantity.

Example

Examples use fictional data. Replace identifiers with resources you can access. For account requests, cookies.txt must contain your own session; set CSRF_TOKEN to the matching CSRF cookie value where required.

Save as request.json
{
  "providerId": "alpaca",
  "symbol": "AAPL",
  "side": "buy",
  "qty": 1
}
cURL (POSIX shell)
curl --include \
  --request POST \
  'https://api.weavers.app/api/broker/orders' \
  --cookie cookies.txt --cookie-jar cookies.txt \
  --header 'x-idempotency-key: example-request-0001' \
  --header "X-Request-Nonce: $(openssl rand -hex 16)" \
  --header "X-Request-Timestamp: $(date +%s)" \
  --header 'Origin: https://weavers.app' \
  --header "X-CSRF-Token: ${CSRF_TOKEN}" \
  --header 'Content-Type: application/json' \
  --data-binary @request.json

Responses

200 · Successful response.

application/json

200 example · synthetic data
{
  "providerId": "alpaca",
  "order": {
    "id": "1",
    "symbol": "AAPL",
    "side": "buy",
    "qty": 1,
    "status": "example",
    "filledQty": 1,
    "filledAvgPrice": null,
    "submittedAt": null
  }
}
View response model
Variant 1: object
providerId required · "alpaca" | "tradier" | "oanda" | "ibkr"
order required · object
View order model
id required · string
symbol required · string
side required · "buy" | "sell"
qty required · number
status required · string
filledQty required · number
filledAvgPrice required · null | number
View filledAvgPrice model
Variant 1: null

null

Variant 2: number

number

submittedAt required · null | string
View submittedAt model
Variant 1: null

null

Variant 2: string

string

Additional fields: JSON values.

Additional fields: JSON values.

400 · Invalid request.

application/json

400 example · synthetic data
{
  "error": "example"
}
View response model
Variant 1: object
error required · string

Additional fields: JSON values.

401 · Authentication is missing or invalid.

application/json

401 example · synthetic data
{}
View response model

Error envelopes can include resource-specific details. Check the status before reading these fields.

error optional · string
code optional · string
message optional · string

Additional fields: JSON values.

403 · Permission, origin or CSRF check failed.

application/json

403 example · synthetic data
{}
View response model

Error envelopes can include resource-specific details. Check the status before reading these fields.

error optional · string
code optional · string
message optional · string

Additional fields: JSON values.

409 · Revision, state or idempotency conflict.

application/json

409 example · synthetic data
{
  "error": "example"
}
View response model
error required · string

Additional fields: JSON values.

429 · Rate limit reached; honor Retry-After when supplied.

application/json

429 example · synthetic data
{}
View response model

Error envelopes can include resource-specific details. Check the status before reading these fields.

error optional · string
code optional · string
message optional · string

Additional fields: JSON values.

500 · Server failure.

application/json

500 example · synthetic data
{
  "error": "example"
}
View response model
error required · string

Additional fields: JSON values.

503 · Service or dependency unavailable.

application/json

503 example · synthetic data
{
  "error": "example"
}
View response model
Variant 1: object
error required · string

Additional fields: JSON values.

default · Operation-specific error. Inspect error/code before deciding whether to retry.

application/json

default example · synthetic data
{
  "error": "example"
}
View response model
Variant 1: object
error required · string

Additional fields: JSON values.