TraderMemos
API リファレンス

Import

GET/api/v1/imports

Authorization

bearerAuth
AuthorizationBearer <token>

Session JWT access token or personal access token (tm_pat_…).

In: header

Response Body

application/json

curl -X GET "https://example.com/api/v1/imports"
[  {    "id": "string",    "user_id": "string",    "account_id": "string",    "source": "csv",    "filename": {      "String": "string",      "Valid": true    },    "column_mapping": {      "String": "string",      "Valid": true    },    "row_count": 0,    "status": "pending",    "created_at": "2019-08-24T14:15:22Z"  }]
POST/api/v1/imports

Parses the upload and returns headers, sample rows, and a suggested column mapping — nothing is written. Accepted uploads:

  • Fill CSV — one row per execution. Known broker exports are detected from the header signature (detected_broker) and pre-fill the mapping and suggested_source_tz.
  • Journal CSV — one row per finished trade (Stonk Journal-style); detected as format: journal_trades, no mapping step.
  • MetaTrader statement — the MT5 Trade History Report (XLSX/HTML) or MT4 Statement / Account History (HTML), detected from content (source: statement); parsed positionally, no mapping. suggested_source_tz is the MetaTrader server-time convention (Europe/Athens), never UTC.
  • JSON backup — a TraderMemos export; account_id may be omitted and is matched (or deferred to commit as pending_account) from the backup's account metadata. CSV/statement uploads require account_id.

Uploads are limited to TM_IMPORT_MAX_BYTES (default 10 MiB) → 413.

Authorization

bearerAuth
AuthorizationBearer <token>

Session JWT access token or personal access token (tm_pat_…).

In: header

Request Body

multipart/form-data

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/imports" \  -F file="string"
{  "headers": [    "string"  ],  "sample_rows": [    {      "property1": "string",      "property2": "string"    }  ],  "suggested_mapping": {    "property1": "string",    "property2": "string"  },  "detected_broker": "string",  "suggested_source_tz": "string",  "format": "executions",  "source": "csv",  "row_count": 0,  "import_batch_id": "string",  "account_id": "string",  "pending_account": {    "name": "string",    "broker": "string",    "account_type": "string",    "base_currency": "string",    "starting_balance": 0  },  "journal_summary": {},  "sample_trades": [    {}  ]}
POST/api/v1/imports/commit

Creates the import batch and commits it in one call — the flow the web client uses after a parse-only preview. For JSON backups without account_id, the account is matched from backup metadata or created. The whole commit is one transaction; on failure the batch is marked failed and no rows are written.

Authorization

bearerAuth
AuthorizationBearer <token>

Session JWT access token or personal access token (tm_pat_…).

In: header

Request Body

multipart/form-data

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/imports/commit" \  -F file="string"
{  "inserted": 0,  "skipped": 0,  "annotated": 0,  "trades": 0,  "cash_inserted": 0,  "setups_upserted": 0,  "format": "string",  "account_id": "string",  "errors": [    {      "row": 0,      "message": "string"    }  ]}
POST/api/v1/imports/{id}/commit

Re-upload the same file and commit it against an existing pending batch.

Authorization

bearerAuth
AuthorizationBearer <token>

Session JWT access token or personal access token (tm_pat_…).

In: header

Path Parameters

id*string

Request Body

multipart/form-data

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/imports/string/commit" \  -F file="string"
{  "inserted": 0,  "skipped": 0,  "annotated": 0,  "trades": 0,  "cash_inserted": 0,  "setups_upserted": 0,  "format": "string",  "account_id": "string",  "errors": [    {      "row": 0,      "message": "string"    }  ]}
DELETE/api/v1/imports/{id}

Deletes the batch's executions, marks the batch reversed, and regroups the account's trades. Journal annotations on surviving trades are unaffected.

Authorization

bearerAuth
AuthorizationBearer <token>

Session JWT access token or personal access token (tm_pat_…).

In: header

Path Parameters

id*string

Response Body

curl -X DELETE "https://example.com/api/v1/imports/string"
Empty