View as Markdown

API reference / AI agents

Agent API

AI agents. Generated from the OpenAPI document the services export (/openapi.json).

Samples use the placeholders YOUR_API_KEY and YOUR_ACCOUNT_ID. Paste a sandbox key (twsk_…) to fill them in and to use Try it. It stays in this browser tab and is only sent to the sandbox, never to the live API.

Try it is off in this build: No sandbox URL is configured for this build of the docs.

GET /v1/agent/accounts

Agent Accounts Auth: X-Tickwire-Agent-Key

Accounts this key may use, by account id. Cursor-paginated: {accounts, has_more, next_cursor}.

Parameters of GET /v1/agent/accounts
ParameterInTypeDescription
limitqueryintegerPage size, 1..500 (default 100).
cursorquerystring | nullThe next_cursor of the previous page, unchanged.

Responses

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/v1/agent/accounts' \
  -H 'X-Tickwire-Agent-Key: YOUR_AGENT_KEY'

Python

from tickwire import AgentClient

with AgentClient("https://api.tickwire.io", "YOUR_AGENT_KEY") as agent:
    result = agent.request(
        "GET",
        "/v1/agent/accounts",
    )
    print(result)

TypeScript

import { AgentClient } from "@tickwire/sdk";

const agent = new AgentClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_AGENT_KEY" });
const result = await agent.request("GET", "/v1/agent/accounts");
console.log(result);
agent.close();
Try it in the sandbox

This call needs an agent key (twag_…), so it isn't available here. Use the agent SDK sample above with your sandbox agent key.

GET /v1/agent/accounts/{account_id}/account-information

Agent Account Info Auth: X-Tickwire-Agent-Key

Balance, equity, margin… as reported by the broker (same shape as /users/current/…).

Parameters of GET /v1/agent/accounts/{account_id}/account-information
ParameterInTypeDescription
account_id requiredpathstring

Responses

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/v1/agent/accounts/YOUR_ACCOUNT_ID/account-information' \
  -H 'X-Tickwire-Agent-Key: YOUR_AGENT_KEY'

Python

from tickwire import AgentClient

with AgentClient("https://api.tickwire.io", "YOUR_AGENT_KEY") as agent:
    result = agent.request(
        "GET",
        "/v1/agent/accounts/YOUR_ACCOUNT_ID/account-information",
    )
    print(result)

TypeScript

import { AgentClient } from "@tickwire/sdk";

const agent = new AgentClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_AGENT_KEY" });
const result = await agent.request("GET", "/v1/agent/accounts/YOUR_ACCOUNT_ID/account-information");
console.log(result);
agent.close();
Try it in the sandbox

This call needs an agent key (twag_…), so it isn't available here. Use the agent SDK sample above with your sandbox agent key.

GET /v1/agent/accounts/{account_id}/health

Agent Health Auth: X-Tickwire-Agent-Key

Truthful health with evidence (connected / disconnected / unknown).

Parameters of GET /v1/agent/accounts/{account_id}/health
ParameterInTypeDescription
account_id requiredpathstring

Responses

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/v1/agent/accounts/YOUR_ACCOUNT_ID/health' \
  -H 'X-Tickwire-Agent-Key: YOUR_AGENT_KEY'

Python

from tickwire import AgentClient

with AgentClient("https://api.tickwire.io", "YOUR_AGENT_KEY") as agent:
    result = agent.request(
        "GET",
        "/v1/agent/accounts/YOUR_ACCOUNT_ID/health",
    )
    print(result)

TypeScript

import { AgentClient } from "@tickwire/sdk";

const agent = new AgentClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_AGENT_KEY" });
const result = await agent.request("GET", "/v1/agent/accounts/YOUR_ACCOUNT_ID/health");
console.log(result);
agent.close();
Try it in the sandbox

This call needs an agent key (twag_…), so it isn't available here. Use the agent SDK sample above with your sandbox agent key.

GET /v1/agent/accounts/{account_id}/history-deals

Agent Deals Auth: X-Tickwire-Agent-Key

Deals in a bounded window (default last 24 h, max 31 days).

Parameters of GET /v1/agent/accounts/{account_id}/history-deals
ParameterInTypeDescription
account_id requiredpathstring
start_timequerystring | null
end_timequerystring | null
limitqueryinteger

Responses

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/v1/agent/accounts/YOUR_ACCOUNT_ID/history-deals' \
  -H 'X-Tickwire-Agent-Key: YOUR_AGENT_KEY'

Python

from tickwire import AgentClient

with AgentClient("https://api.tickwire.io", "YOUR_AGENT_KEY") as agent:
    result = agent.request(
        "GET",
        "/v1/agent/accounts/YOUR_ACCOUNT_ID/history-deals",
    )
    print(result)

TypeScript

import { AgentClient } from "@tickwire/sdk";

const agent = new AgentClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_AGENT_KEY" });
const result = await agent.request("GET", "/v1/agent/accounts/YOUR_ACCOUNT_ID/history-deals");
console.log(result);
agent.close();
Try it in the sandbox

This call needs an agent key (twag_…), so it isn't available here. Use the agent SDK sample above with your sandbox agent key.

GET /v1/agent/accounts/{account_id}/orders

Agent Orders Auth: X-Tickwire-Agent-Key

Pending orders (same shape as /users/current/accounts/{id}/orders).

Parameters of GET /v1/agent/accounts/{account_id}/orders
ParameterInTypeDescription
account_id requiredpathstring

Responses

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/v1/agent/accounts/YOUR_ACCOUNT_ID/orders' \
  -H 'X-Tickwire-Agent-Key: YOUR_AGENT_KEY'

Python

from tickwire import AgentClient

with AgentClient("https://api.tickwire.io", "YOUR_AGENT_KEY") as agent:
    result = agent.request(
        "GET",
        "/v1/agent/accounts/YOUR_ACCOUNT_ID/orders",
    )
    print(result)

TypeScript

import { AgentClient } from "@tickwire/sdk";

const agent = new AgentClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_AGENT_KEY" });
const result = await agent.request("GET", "/v1/agent/accounts/YOUR_ACCOUNT_ID/orders");
console.log(result);
agent.close();
Try it in the sandbox

This call needs an agent key (twag_…), so it isn't available here. Use the agent SDK sample above with your sandbox agent key.

GET /v1/agent/accounts/{account_id}/positions

Agent Positions Auth: X-Tickwire-Agent-Key

Open positions (same shape as /users/current/accounts/{id}/positions).

Parameters of GET /v1/agent/accounts/{account_id}/positions
ParameterInTypeDescription
account_id requiredpathstring

Responses

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/v1/agent/accounts/YOUR_ACCOUNT_ID/positions' \
  -H 'X-Tickwire-Agent-Key: YOUR_AGENT_KEY'

Python

from tickwire import AgentClient

with AgentClient("https://api.tickwire.io", "YOUR_AGENT_KEY") as agent:
    result = agent.request(
        "GET",
        "/v1/agent/accounts/YOUR_ACCOUNT_ID/positions",
    )
    print(result)

TypeScript

import { AgentClient } from "@tickwire/sdk";

const agent = new AgentClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_AGENT_KEY" });
const result = await agent.request("GET", "/v1/agent/accounts/YOUR_ACCOUNT_ID/positions");
console.log(result);
agent.close();
Try it in the sandbox

This call needs an agent key (twag_…), so it isn't available here. Use the agent SDK sample above with your sandbox agent key.

GET /v1/agent/accounts/{account_id}/snapshot

Agent Snapshot Auth: X-Tickwire-Agent-Key

Account information, positions, orders, health and server time in one read, with as_of and per-section freshness.

Parameters of GET /v1/agent/accounts/{account_id}/snapshot
ParameterInTypeDescription
account_id requiredpathstring

Responses

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/v1/agent/accounts/YOUR_ACCOUNT_ID/snapshot' \
  -H 'X-Tickwire-Agent-Key: YOUR_AGENT_KEY'

Python

from tickwire import AgentClient

with AgentClient("https://api.tickwire.io", "YOUR_AGENT_KEY") as agent:
    result = agent.request(
        "GET",
        "/v1/agent/accounts/YOUR_ACCOUNT_ID/snapshot",
    )
    print(result)

TypeScript

import { AgentClient } from "@tickwire/sdk";

const agent = new AgentClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_AGENT_KEY" });
const result = await agent.request("GET", "/v1/agent/accounts/YOUR_ACCOUNT_ID/snapshot");
console.log(result);
agent.close();
Try it in the sandbox

This call needs an agent key (twag_…), so it isn't available here. Use the agent SDK sample above with your sandbox agent key.

GET /v1/agent/accounts/{account_id}/symbols/{symbol}/current-price

Agent Price Auth: X-Tickwire-Agent-Key

Current bid/ask with broker time.

Parameters of GET /v1/agent/accounts/{account_id}/symbols/{symbol}/current-price
ParameterInTypeDescription
account_id requiredpathstring
symbol requiredpathstring

Responses

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/v1/agent/accounts/YOUR_ACCOUNT_ID/symbols/EURUSD/current-price' \
  -H 'X-Tickwire-Agent-Key: YOUR_AGENT_KEY'

Python

from tickwire import AgentClient

with AgentClient("https://api.tickwire.io", "YOUR_AGENT_KEY") as agent:
    result = agent.request(
        "GET",
        "/v1/agent/accounts/YOUR_ACCOUNT_ID/symbols/EURUSD/current-price",
    )
    print(result)

TypeScript

import { AgentClient } from "@tickwire/sdk";

const agent = new AgentClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_AGENT_KEY" });
const result = await agent.request("GET", "/v1/agent/accounts/YOUR_ACCOUNT_ID/symbols/EURUSD/current-price");
console.log(result);
agent.close();
Try it in the sandbox

This call needs an agent key (twag_…), so it isn't available here. Use the agent SDK sample above with your sandbox agent key.

GET /v1/agent/accounts/{account_id}/symbols/{symbol}/specification

Agent Spec Auth: X-Tickwire-Agent-Key

Symbol specification: volume limits and step, digits, contract size…

Parameters of GET /v1/agent/accounts/{account_id}/symbols/{symbol}/specification
ParameterInTypeDescription
account_id requiredpathstring
symbol requiredpathstring

Responses

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/v1/agent/accounts/YOUR_ACCOUNT_ID/symbols/EURUSD/specification' \
  -H 'X-Tickwire-Agent-Key: YOUR_AGENT_KEY'

Python

from tickwire import AgentClient

with AgentClient("https://api.tickwire.io", "YOUR_AGENT_KEY") as agent:
    result = agent.request(
        "GET",
        "/v1/agent/accounts/YOUR_ACCOUNT_ID/symbols/EURUSD/specification",
    )
    print(result)

TypeScript

import { AgentClient } from "@tickwire/sdk";

const agent = new AgentClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_AGENT_KEY" });
const result = await agent.request("GET", "/v1/agent/accounts/YOUR_ACCOUNT_ID/symbols/EURUSD/specification");
console.log(result);
agent.close();
Try it in the sandbox

This call needs an agent key (twag_…), so it isn't available here. Use the agent SDK sample above with your sandbox agent key.

POST /v1/agent/accounts/{account_id}/trade

Agent Trade Idempotency-Key Auth: X-Tickwire-Agent-Key

Place, modify, close or cancel a trade. Each trade is checked against the key's limits, the pre-trade hooks and the kill switches before it is sent, and is recorded in the audit trail.

Parameters of POST /v1/agent/accounts/{account_id}/trade
ParameterInTypeDescription
account_id requiredpathstring
Idempotency-Keyheaderstring | null
X-Reasonheaderstring | null

Request body any

Responses

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X POST 'https://api.tickwire.io/v1/agent/accounts/YOUR_ACCOUNT_ID/trade' \
  -H 'X-Tickwire-Agent-Key: YOUR_AGENT_KEY' \
  -H 'Idempotency-Key: my-request-1' \
  -H 'X-Reason: why you are doing this' \
  -H 'Content-Type: application/json' \
  -d '{"actionType":"ORDER_TYPE_BUY","symbol":"EURUSD","volume":0.01}'

Python

from tickwire import AgentClient

with AgentClient("https://api.tickwire.io", "YOUR_AGENT_KEY") as agent:
    result = agent.request(
        "POST",
        "/v1/agent/accounts/YOUR_ACCOUNT_ID/trade",
        json={"actionType": "ORDER_TYPE_BUY", "symbol": "EURUSD", "volume": 0.01},
        idempotency_key="my-request-1",
        reason="why you are doing this",
    )
    print(result)

TypeScript

import { AgentClient } from "@tickwire/sdk";

const agent = new AgentClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_AGENT_KEY" });
const result = await agent.request("POST", "/v1/agent/accounts/YOUR_ACCOUNT_ID/trade", {
  body: {"actionType":"ORDER_TYPE_BUY","symbol":"EURUSD","volume":0.01},
  idempotencyKey: "my-request-1",
  reason: "why you are doing this",
});
console.log(result);
agent.close();
Try it in the sandbox

This call needs an agent key (twag_…), so it isn't available here. Use the agent SDK sample above with your sandbox agent key.

GET /v1/agent/audit

Agent Own Audit Auth: X-Tickwire-Agent-Key

This key's own audit entries, newest first. Cursor-paginated: {entries, has_more, next_cursor}.

Parameters of GET /v1/agent/audit
ParameterInTypeDescription
limitqueryintegerPage size, 1..500 (default 50).
beforequeryinteger | null
cursorquerystring | nullThe next_cursor of the previous page, unchanged.

Responses

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/v1/agent/audit' \
  -H 'X-Tickwire-Agent-Key: YOUR_AGENT_KEY'

Python

from tickwire import AgentClient

with AgentClient("https://api.tickwire.io", "YOUR_AGENT_KEY") as agent:
    result = agent.request(
        "GET",
        "/v1/agent/audit",
    )
    print(result)

TypeScript

import { AgentClient } from "@tickwire/sdk";

const agent = new AgentClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_AGENT_KEY" });
const result = await agent.request("GET", "/v1/agent/audit");
console.log(result);
agent.close();
Try it in the sandbox

This call needs an agent key (twag_…), so it isn't available here. Use the agent SDK sample above with your sandbox agent key.

GET /v1/agent/me

Agent Me Auth: X-Tickwire-Agent-Key

This key's permissions, kill switches and applicable hooks.

Responses

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/v1/agent/me' \
  -H 'X-Tickwire-Agent-Key: YOUR_AGENT_KEY'

Python

from tickwire import AgentClient

with AgentClient("https://api.tickwire.io", "YOUR_AGENT_KEY") as agent:
    result = agent.request(
        "GET",
        "/v1/agent/me",
    )
    print(result)

TypeScript

import { AgentClient } from "@tickwire/sdk";

const agent = new AgentClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_AGENT_KEY" });
const result = await agent.request("GET", "/v1/agent/me");
console.log(result);
agent.close();
Try it in the sandbox

This call needs an agent key (twag_…), so it isn't available here. Use the agent SDK sample above with your sandbox agent key.

GET /v1/agent/requests/{idempotency_key}

Agent Request Status Auth: X-Tickwire-Agent-Key

What happened to the trade sent with this idempotency key.

Parameters of GET /v1/agent/requests/{idempotency_key}
ParameterInTypeDescription
idempotency_key requiredpathstring

Responses

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/v1/agent/requests/IDEMPOTENCY_KEY' \
  -H 'X-Tickwire-Agent-Key: YOUR_AGENT_KEY'

Python

from tickwire import AgentClient

with AgentClient("https://api.tickwire.io", "YOUR_AGENT_KEY") as agent:
    result = agent.request(
        "GET",
        "/v1/agent/requests/IDEMPOTENCY_KEY",
    )
    print(result)

TypeScript

import { AgentClient } from "@tickwire/sdk";

const agent = new AgentClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_AGENT_KEY" });
const result = await agent.request("GET", "/v1/agent/requests/IDEMPOTENCY_KEY");
console.log(result);
agent.close();
Try it in the sandbox

This call needs an agent key (twag_…), so it isn't available here. Use the agent SDK sample above with your sandbox agent key.