nrg.market API reference Interactive reference

Address book

Names, notes and tags for the addresses you use, with what this account did with each

GET /address-book

List address book entries

Authentication: Required — an API key in Authorization: Bearer … (authentication).

Your saved addresses, ordered by name (case-insensitive), then by id. Only active entries are ever returned. Each entry carries usage — what this account did with the address — computed when you read it, so it is the same for an address deleted and saved again.

Filters combine: q is a case-insensitive fragment of the name, of any tag, or of the address; tag may be repeated, and an entry must carry every tag named. A tag value matches the tags your book holds under the same identity the book stores them by (Unicode case folding, see POST), and a value your book has no such tag for matches nothing. At most ten tag values: an entry carries no more than ten tags. address may be repeated, up to 50 times, and narrows the list to the entries with exactly these addresses; an address your book does not hold is simply absent from the answer, not an error. A value that is not a valid TRON address is 400 invalid_address; more than 50 is 400 invalid_request. Order and pagination are the same with or without it — reading the network's facts for rows you already show is address=…&address=…&include=chain.

include=chain adds the network's facts about each address — the same ones GET /address-check gives, minus the address. The page is then at most 50 entries (a larger limit is 400 invalid_request, which costs only the request's own token).

It is priced like POST /estimate: besides the request's own token, each address of the page that our short-lived address cache does not hold costs one more token of the reference bucket; a cached address is free, so repeating the same read at once costs one token. The charge is taken before anything is asked of the chain. A request the bucket cannot pay for is refused whole — 429 rate_limited, no list — with a Retry-After that is the time until the bucket is full again (the same as RateLimit-Reset); after it the same request passes, provided the key spends nothing else from the bucket meanwhile. To get the list without paying for the facts, ask without include=chain. The RateLimit-* headers of a success describe the reference bucket after both charges.

If the network cannot be read, the list is not refused: every entry comes back with chain: null, and chain_unavailable is true. Without include=chain, chain is always null and chain_unavailable always false.

Parameters

NameInRequiredTypeDescription
qqueryoptionalstring
tagqueryoptionalarray of string

Maximum items: 10. Serialized with style form, explode true.

addressqueryoptionalarray of TronAddress

Minimum items: 1. Maximum items: 50. Serialized with style form, explode true.

includequeryoptionalstring

One of: chain.

cursorqueryoptionalstring
limitqueryoptionalinteger

Default: 50. Minimum: 1. Maximum: 200.

Responses

200

OK

Content type application/json.

FieldTypeRequiredDescription
dataarray of AddressBookEntryrequired
next_cursorstring or nullrequired
chain_unavailablebooleanrequired

true only when include=chain was asked and the network could not be read; every entry then has chain: null.

400

Malformed request

Content type application/json.

Schema: Error.

401

Invalid key or IP not allowed

Content type application/json.

Schema: Error.

429

Rate limit exceeded (rate_limited), or too many failed authorizations from this credential (too_many_auth_failures). Both are 429 and both carry Retry-After; they differ in what you should do about it, which is why they differ in code and not only in message. rate_limited also carries the RateLimit-* state of the bucket it came from; too_many_auth_failures does not, because the counter behind it is not a bucket. See "Rate limits" and "Repeated authorization failures" above.

On POST /orders a rate_limited may also carry details.reason = bulk_volume_cap: not requests per minute but energy per window — a mode c order whose volumes would take your account past the bulk allowance. details carries cap_units (the allowance), spent_units (your volume already inside the window), requested_units (what this order asked for) and window_s (the width of the window, 3600). Retry-After is the first instant at which this body can be accepted: enough of your counted volume has to leave the window to make room for requested_units, which is not in general the moment the oldest position leaves — one departure frees only that position's units. An order whose own volume is larger than the whole allowance is not answered here at all: no waiting would help it, and it is 400 invalid_request with details.reason = bulk_order_over_cap. It is a pace limit like the others, so it is the same code: the order is not wrong, and the same body sent later is accepted. It carries no RateLimit-* headers: those describe a bucket of requests per minute, and this allowance is energy per hour — details above is its whole state.

Content type application/json.

Schema: Error.

HeaderTypeDescription
Retry-Afterinteger

Seconds to wait before retrying.

RateLimit-Limitinteger

Requests per minute in this bucket — per UTC day on POST /sandbox/deposit, the one allowance in this API that is not counted per minute. Absent in exactly three cases, and in none is a number invented for it: the limiter could not read the bucket state (the request is let through then), the answer is too_many_auth_failures, which is counted by the authorization-failure counter and not by a bucket — see "Repeated authorization failures" — or it is the volume allowance (details.reason = bulk_volume_cap), which is energy per hour rather than requests per minute.

RateLimit-Remaininginteger

Requests left in this bucket right now.

RateLimit-Resetinteger

Seconds until the bucket is full again.

POST /address-book

Save an address

Authentication: Required — an API key in Authorization: Bearer … (authentication).

Gives an address a name, an optional note and up to ten tags. One active entry per address: saving an address that is already in the book is 409 address_book_conflict with details.reason = address_already_saved and the existing entry in details.id — edit that one instead.

Tags are case-insensitive, by Unicode default case folding: exchanges and Exchanges are one tag, and so are ΟΔΟΣ and οδος, or STRASSE and straße. No language-specific rule is applied: İstanbul and istanbul are two tags. A tag repeated in another case within the body keeps its first spelling, and a tag your book already uses is stored in the spelling the book already has.

The book holds at most 2000 active entries and 200 distinct tags. Past either, 409 address_book_conflict with details.reason = entries_limit_reached or tags_limit_reached, and details.limit and details.current. Deleted entries count towards neither.

A malformed address is 400 invalid_address; a name, note or tag out of bounds, or carrying text that cannot be stored — a NUL character (\u0000) or a lone UTF-16 surrogate (an unpaired \ud800–\udfff escape) — is 400 invalid_request with details.errors. An empty or blank note is stored as null.

Request body

Required.

Content type application/json.

Schema: AddressBookEntryCreate.

FieldTypeRequiredDescription
addressTronAddressrequired
namestringrequired

Trimmed of surrounding spaces; 1–64 characters after that.

Minimum length: 1. Maximum length: 64.

notestring or nulloptional

Empty or blank is stored as null.

Maximum length: 280.

tagsarray of stringoptional

Up to ten distinct tags. Each is trimmed and must then be 1–32 characters with no comma, |, carriage return or line feed. Compared by Unicode case folding: a tag repeated in another case keeps its first spelling, and a tag your book already uses is stored in the book's spelling. The ten are counted after that collapse; the array itself may carry at most 50 items. Order is kept. Omitted, the entry has none.

Maximum items: 50. Each item — Minimum length: 1. Maximum length: 32.

Example: payroll
{
  "address": "TN3W4H6rK2ce4vX9YnFQHwKENnHjoxb3m9",
  "name": "Payroll hot wallet",
  "tags": [
    "Staff",
    "Hot"
  ]
}

Responses

201

Saved

Content type application/json.

Schema: AddressBookEntry.

400

Malformed request

Content type application/json.

Schema: Error.

401

Invalid key or IP not allowed

Content type application/json.

Schema: Error.

409

address_book_conflict. details.reason: address_already_saved (with id), entries_limit_reached or tags_limit_reached (with limit and current).

Content type application/json.

Schema: Error.

PATCH /address-book/{entry_id}

Edit an entry

Authentication: Required — an API key in Authorization: Bearer … (authentication).

Only the fields you send change. tags replaces the whole array ([] removes every tag); note: null clears the note. name and tags may be omitted but not sent as null. The address is not editable: address in this body is ignored, like any key the body does not define — a name for another address is another entry. An empty body is a legal no-op and returns the entry as it is.

Tags follow the same rules as on POST, and so does the tag ceiling: a new tag past 200 distinct ones is 409 address_book_conflict, details.reason = tags_limit_reached. A deleted entry, like another account's, is 404.

Parameters

NameInRequiredTypeDescription
entry_idpathrequiredstring

Request body

Required.

Content type application/json.

Schema: AddressBookEntryUpdate.

FieldTypeRequiredDescription
namestringoptional

Minimum length: 1. Maximum length: 64.

notestring or nulloptional

Maximum length: 280.

tagsarray of stringoptional

Replaces the whole array. Same rules as on creation: up to ten distinct tags, at most 50 items as sent.

Maximum items: 50. Each item — Minimum length: 1. Maximum length: 32.

Example: New tags, same name
{
  "tags": [
    "Staff",
    "Cold"
  ]
}

Responses

200

OK

Content type application/json.

Schema: AddressBookEntry.

400

Malformed request

Content type application/json.

Schema: Error.

401

Invalid key or IP not allowed

Content type application/json.

Schema: Error.

404

Not found

Content type application/json.

Schema: Error.

409

address_book_conflict, details.reason = tags_limit_reached

Content type application/json.

Schema: Error.

DELETE /address-book/{entry_id}

Delete an entry

Authentication: Required — an API key in Authorization: Bearer … (authentication).

The entry leaves the book, and the address may be saved again at once. What the account did with the address is untouched: saved again, it shows the same usage. Deleting again returns 404. A deleted entry is kept for the record, up to as many as the book holds live entries (2000); past that, the oldest deleted entries are removed for good.

Parameters

NameInRequiredTypeDescription
entry_idpathrequiredstring

Responses

204

Deleted

No body.

401

Invalid key or IP not allowed

Content type application/json.

Schema: Error.

404

Not found

Content type application/json.

Schema: Error.

POST /address-book/import

Import addresses

Authentication: Required — an API key in Authorization: Bearer … (authentication).

Saves up to 500 rows in one call. Not atomic: every row is judged on its own, valid rows are saved even when others fail, and each row gets a result at its index in the body — created (with the new entry's id), exists (with the id of the entry already saved for that address, which is left untouched) or error with a reason.

A row follows the rules of POST /address-book — the same bounds, the same tag rules — and is judged in this order: its shape, field by field (invalid_address, invalid_name, invalid_note, invalid_tags; a NUL character or a lone surrogate in any of them is that field's error); then duplicate_in_request for every row after the first that names the same address (the first one is the row judged, whatever became of it); then exists; then the book's ceilings, counted with the rows this body has already saved: entries_limit_reached for every new address once the book is full, tags_limit_reached for a row that would bring a new tag past 200 — a later row that reuses the book's tags is still saved.

Only the body as a whole can be refused: not an object with an entries list, an empty list, more than 500 rows, or a row that is not an object is 400 invalid_request, and nothing is saved.

Priced by size. Besides the request's own token, the body pays one more token of the reference bucket per started 25 rows past the first 25 — 500 rows cost 20 tokens, 26 cost 2, 25 or fewer cost 1. The charge is taken before anything is done; when the bucket cannot cover it the answer is 429 with a Retry-After after which the same body passes, and nothing is written. No body costs more than a full bucket.

Request body

Required.

Content type application/json.

Schema: AddressBookImport.

FieldTypeRequiredDescription
entriesarray of AddressBookEntryCreaterequired

Each row has the shape of AddressBookEntryCreate, but is judged on its own: a row that breaks it is an error in the result, not a refusal of the body. Only a row that is not an object refuses the body.

Minimum items: 1. Maximum items: 500.

Example: two
{
  "entries": [
    {
      "address": "TN3W4H6rK2ce4vX9YnFQHwKENnHjoxb3m9",
      "name": "Payroll hot wallet",
      "tags": [
        "Staff"
      ]
    },
    {
      "address": "TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW",
      "name": "Cold storage"
    }
  ]
}

Responses

200

Every row's result, in body order

Content type application/json.

Schema: AddressBookImportResult.

400

Malformed request

Content type application/json.

Schema: Error.

401

Invalid key or IP not allowed

Content type application/json.

Schema: Error.

429

Rate limit exceeded (rate_limited), or too many failed authorizations from this credential (too_many_auth_failures). Both are 429 and both carry Retry-After; they differ in what you should do about it, which is why they differ in code and not only in message. rate_limited also carries the RateLimit-* state of the bucket it came from; too_many_auth_failures does not, because the counter behind it is not a bucket. See "Rate limits" and "Repeated authorization failures" above.

On POST /orders a rate_limited may also carry details.reason = bulk_volume_cap: not requests per minute but energy per window — a mode c order whose volumes would take your account past the bulk allowance. details carries cap_units (the allowance), spent_units (your volume already inside the window), requested_units (what this order asked for) and window_s (the width of the window, 3600). Retry-After is the first instant at which this body can be accepted: enough of your counted volume has to leave the window to make room for requested_units, which is not in general the moment the oldest position leaves — one departure frees only that position's units. An order whose own volume is larger than the whole allowance is not answered here at all: no waiting would help it, and it is 400 invalid_request with details.reason = bulk_order_over_cap. It is a pace limit like the others, so it is the same code: the order is not wrong, and the same body sent later is accepted. It carries no RateLimit-* headers: those describe a bucket of requests per minute, and this allowance is energy per hour — details above is its whole state.

Content type application/json.

Schema: Error.

HeaderTypeDescription
Retry-Afterinteger

Seconds to wait before retrying.

RateLimit-Limitinteger

Requests per minute in this bucket — per UTC day on POST /sandbox/deposit, the one allowance in this API that is not counted per minute. Absent in exactly three cases, and in none is a number invented for it: the limiter could not read the bucket state (the request is let through then), the answer is too_many_auth_failures, which is counted by the authorization-failure counter and not by a bucket — see "Repeated authorization failures" — or it is the volume allowance (details.reason = bulk_volume_cap), which is energy per hour rather than requests per minute.

RateLimit-Remaininginteger

Requests left in this bucket right now.

RateLimit-Resetinteger

Seconds until the bucket is full again.

GET /address-book/suggestions

Addresses worth saving

Authentication: Required — an API key in Authorization: Bearer … (authentication).

Addresses from this account's own history — its order items (either side), queue sessions, queue items and auto-refill rules — that have no entry in the book. An address whose entry was deleted is suggested again. Your own deposit addresses are never suggested, and neither is anything from another account's history.

Ordered by orders_as_sender + orders_as_recipient descending, then last_used_at descending. The counts and last_used_at mean what they mean in an entry's usage.

Parameters

NameInRequiredTypeDescription
limitqueryoptionalinteger

Default: 20. Minimum: 1. Maximum: 50.

Responses

200

OK

Content type application/json.

FieldTypeRequiredDescription
dataarray of AddressBookSuggestionrequired

400

Malformed request

Content type application/json.

Schema: Error.

401

Invalid key or IP not allowed

Content type application/json.

Schema: Error.

429

Rate limit exceeded (rate_limited), or too many failed authorizations from this credential (too_many_auth_failures). Both are 429 and both carry Retry-After; they differ in what you should do about it, which is why they differ in code and not only in message. rate_limited also carries the RateLimit-* state of the bucket it came from; too_many_auth_failures does not, because the counter behind it is not a bucket. See "Rate limits" and "Repeated authorization failures" above.

On POST /orders a rate_limited may also carry details.reason = bulk_volume_cap: not requests per minute but energy per window — a mode c order whose volumes would take your account past the bulk allowance. details carries cap_units (the allowance), spent_units (your volume already inside the window), requested_units (what this order asked for) and window_s (the width of the window, 3600). Retry-After is the first instant at which this body can be accepted: enough of your counted volume has to leave the window to make room for requested_units, which is not in general the moment the oldest position leaves — one departure frees only that position's units. An order whose own volume is larger than the whole allowance is not answered here at all: no waiting would help it, and it is 400 invalid_request with details.reason = bulk_order_over_cap. It is a pace limit like the others, so it is the same code: the order is not wrong, and the same body sent later is accepted. It carries no RateLimit-* headers: those describe a bucket of requests per minute, and this allowance is energy per hour — details above is its whole state.

Content type application/json.

Schema: Error.

HeaderTypeDescription
Retry-Afterinteger

Seconds to wait before retrying.

RateLimit-Limitinteger

Requests per minute in this bucket — per UTC day on POST /sandbox/deposit, the one allowance in this API that is not counted per minute. Absent in exactly three cases, and in none is a number invented for it: the limiter could not read the bucket state (the request is let through then), the answer is too_many_auth_failures, which is counted by the authorization-failure counter and not by a bucket — see "Repeated authorization failures" — or it is the volume allowance (details.reason = bulk_volume_cap), which is energy per hour rather than requests per minute.

RateLimit-Remaininginteger

Requests left in this bucket right now.

RateLimit-Resetinteger

Seconds until the bucket is full again.

GET /address-book/tags

List the book's tags

Authentication: Required — an API key in Authorization: Bearer … (authentication).

Every tag in the book, once per tag (tags compare by Unicode case folding, as on POST /address-book) and in the book's spelling, with count — the number of entries carrying it. Deleted entries count for nothing: a tag that only they carried is not listed. Ordered case-insensitively, by that same folding.

Responses

200

OK

Content type application/json.

FieldTypeRequiredDescription
dataarray of AddressBookTagrequired

401

Invalid key or IP not allowed

Content type application/json.

Schema: Error.

429

Rate limit exceeded (rate_limited), or too many failed authorizations from this credential (too_many_auth_failures). Both are 429 and both carry Retry-After; they differ in what you should do about it, which is why they differ in code and not only in message. rate_limited also carries the RateLimit-* state of the bucket it came from; too_many_auth_failures does not, because the counter behind it is not a bucket. See "Rate limits" and "Repeated authorization failures" above.

On POST /orders a rate_limited may also carry details.reason = bulk_volume_cap: not requests per minute but energy per window — a mode c order whose volumes would take your account past the bulk allowance. details carries cap_units (the allowance), spent_units (your volume already inside the window), requested_units (what this order asked for) and window_s (the width of the window, 3600). Retry-After is the first instant at which this body can be accepted: enough of your counted volume has to leave the window to make room for requested_units, which is not in general the moment the oldest position leaves — one departure frees only that position's units. An order whose own volume is larger than the whole allowance is not answered here at all: no waiting would help it, and it is 400 invalid_request with details.reason = bulk_order_over_cap. It is a pace limit like the others, so it is the same code: the order is not wrong, and the same body sent later is accepted. It carries no RateLimit-* headers: those describe a bucket of requests per minute, and this allowance is energy per hour — details above is its whole state.

Content type application/json.

Schema: Error.

HeaderTypeDescription
Retry-Afterinteger

Seconds to wait before retrying.

RateLimit-Limitinteger

Requests per minute in this bucket — per UTC day on POST /sandbox/deposit, the one allowance in this API that is not counted per minute. Absent in exactly three cases, and in none is a number invented for it: the limiter could not read the bucket state (the request is let through then), the answer is too_many_auth_failures, which is counted by the authorization-failure counter and not by a bucket — see "Repeated authorization failures" — or it is the volume allowance (details.reason = bulk_volume_cap), which is energy per hour rather than requests per minute.

RateLimit-Remaininginteger

Requests left in this bucket right now.

RateLimit-Resetinteger

Seconds until the bucket is full again.

POST /address-book/tags/rename

Rename a tag

Authentication: Required — an API key in Authorization: Bearer … (authentication).

Every entry carrying from gets to in its place, at the same position; updated is the number of entries changed. Both are matched case-insensitively, by Unicode case folding.

  • Merge. If to is already a tag of the book, the two become one: an entry carrying both keeps a single copy, and the book's existing spelling of to is kept — the rule of every write.
  • Re-spelling. from and to equal case-insensitively (hot → HOT) re-spells the tag on every entry carrying it, exactly as to is sent.

from on no entry of the book is 404 not_found. Both follow the rules of a tag (1–32 characters after trimming, no ,, |, line break, NUL or lone surrogate); otherwise 400 invalid_request.

Request body

Required.

Content type application/json.

Schema: AddressBookTagRename.

FieldTypeRequiredDescription
fromstringrequired

Minimum length: 1. Maximum length: 32.

tostringrequired

Minimum length: 1. Maximum length: 32.

Example: merge
{
  "from": "Exchanges",
  "to": "Exchange"
}

Responses

200

OK

Content type application/json.

Schema: AddressBookUpdated.

400

Malformed request

Content type application/json.

Schema: Error.

401

Invalid key or IP not allowed

Content type application/json.

Schema: Error.

404

Not found

Content type application/json.

Schema: Error.

POST /address-book/tags/delete

Delete a tag

Authentication: Required — an API key in Authorization: Bearer … (authentication).

Takes the tag — in any case — off every entry carrying it; the entries themselves stay. updated is the number of entries changed. A tag on no entry of the book is 404 not_found.

Request body

Required.

Content type application/json.

Schema: AddressBookTagDelete.

FieldTypeRequiredDescription
tagstringrequired

Minimum length: 1. Maximum length: 32.

Responses

200

OK

Content type application/json.

Schema: AddressBookUpdated.

400

Malformed request

Content type application/json.

Schema: Error.

401

Invalid key or IP not allowed

Content type application/json.

Schema: Error.

404

Not found

Content type application/json.

Schema: Error.

POST /address-book/bulk-tags

Tag or untag many entries

Authentication: Required — an API key in Authorization: Bearer … (authentication).

Adds and removes tags on up to 500 entries at once. remove is applied first, then add: a tag named in both ends up on every listed entry — where it already stood on the entries that carried it, at the end on the others. Adding a tag an entry already carries (in any case), or removing one it does not carry, changes nothing and is not an error. An added tag the book already has is stored in the book's spelling. updated is the number of entries actually changed, not the number listed.

All or nothing. Nothing is changed unless every check passes, in this order: an id that is not an active entry of your book (deleted, another account's, unknown) is 404 not_found; an entry that would end with more than ten tags is 409 address_book_conflict with details.reason = entry_tags_limit_reached and every such entry in details.ids; a new tag past the book's 200 distinct tags is 409 with tags_limit_reached — counted after the removals.

At least one of add and remove must name a tag, and each carries at most ten items as sent — not only ten distinct ones. A malformed id is 400 invalid_request.

Priced by size. Besides the request's own token, the body pays one more token of the reference bucket per started 25 ids past the first 25 — 500 ids cost 20 tokens, 25 or fewer cost 1. The charge is taken before anything is done; when the bucket cannot cover it the answer is 429 with a Retry-After after which the same body passes, and nothing is written. No body costs more than a full bucket.

Request body

Required.

Content type application/json.

Schema: AddressBookBulkTags.

FieldTypeRequiredDescription
idsarray of string (uuid)required

Entry ids; a repeated id counts once.

Minimum items: 1. Maximum items: 500.

addarray of stringoptional

Tags to put on every listed entry, after remove. At most ten items as sent.

Maximum items: 10. Each item — Minimum length: 1. Maximum length: 32.

removearray of stringoptional

Tags to take off every listed entry, before add. At most ten items as sent.

Maximum items: 10. Each item — Minimum length: 1. Maximum length: 32.

Example: retag
{
  "ids": [
    "0b6f2c1e-4a1e-4a5f-9b8a-2f5f0d9c1a77"
  ],
  "add": [
    "Staff"
  ],
  "remove": [
    "Contractors"
  ]
}

Responses

200

OK

Content type application/json.

Schema: AddressBookUpdated.

400

Malformed request

Content type application/json.

Schema: Error.

401

Invalid key or IP not allowed

Content type application/json.

Schema: Error.

404

Not found

Content type application/json.

Schema: Error.

429

Rate limit exceeded (rate_limited), or too many failed authorizations from this credential (too_many_auth_failures). Both are 429 and both carry Retry-After; they differ in what you should do about it, which is why they differ in code and not only in message. rate_limited also carries the RateLimit-* state of the bucket it came from; too_many_auth_failures does not, because the counter behind it is not a bucket. See "Rate limits" and "Repeated authorization failures" above.

On POST /orders a rate_limited may also carry details.reason = bulk_volume_cap: not requests per minute but energy per window — a mode c order whose volumes would take your account past the bulk allowance. details carries cap_units (the allowance), spent_units (your volume already inside the window), requested_units (what this order asked for) and window_s (the width of the window, 3600). Retry-After is the first instant at which this body can be accepted: enough of your counted volume has to leave the window to make room for requested_units, which is not in general the moment the oldest position leaves — one departure frees only that position's units. An order whose own volume is larger than the whole allowance is not answered here at all: no waiting would help it, and it is 400 invalid_request with details.reason = bulk_order_over_cap. It is a pace limit like the others, so it is the same code: the order is not wrong, and the same body sent later is accepted. It carries no RateLimit-* headers: those describe a bucket of requests per minute, and this allowance is energy per hour — details above is its whole state.

Content type application/json.

Schema: Error.

HeaderTypeDescription
Retry-Afterinteger

Seconds to wait before retrying.

RateLimit-Limitinteger

Requests per minute in this bucket — per UTC day on POST /sandbox/deposit, the one allowance in this API that is not counted per minute. Absent in exactly three cases, and in none is a number invented for it: the limiter could not read the bucket state (the request is let through then), the answer is too_many_auth_failures, which is counted by the authorization-failure counter and not by a bucket — see "Repeated authorization failures" — or it is the volume allowance (details.reason = bulk_volume_cap), which is energy per hour rather than requests per minute.

RateLimit-Remaininginteger

Requests left in this bucket right now.

RateLimit-Resetinteger

Seconds until the bucket is full again.

409

address_book_conflict. details.reason: entry_tags_limit_reached (with ids) or tags_limit_reached (with limit and current).

Content type application/json.

Schema: Error.

POST /address-book/bulk-delete

Delete many entries

Authentication: Required — an API key in Authorization: Bearer … (authentication).

Deletes, in one transaction, every listed id that is an entry of your book — the same soft deletion as DELETE /address-book/{entry_id}: each address may be saved again at once, and its usage is unchanged.

An id that is not an entry of your book — another account's, one already deleted, one that never existed — is skipped without an error, and the answer does not say which of the three it was. The call is therefore idempotent: repeating it after a lost answer deletes nothing twice. deleted counts the entries this call deleted. A repeated id counts once.

A malformed id, or fewer than 1 or more than 500 ids, is 400 invalid_request.

Priced by size. Besides the request's own token, the body pays one more token of the reference bucket per started 25 ids past the first 25 — 500 ids cost 20 tokens, 25 or fewer cost 1. The charge is taken before anything is done; when the bucket cannot cover it the answer is 429 with a Retry-After after which the same body passes, and nothing is written. No body costs more than a full bucket.

Request body

Required.

Content type application/json.

Schema: AddressBookBulkDelete.

FieldTypeRequiredDescription
idsarray of string (uuid)required

Entry ids; a repeated id counts once, and one that is not an entry of your book is skipped.

Minimum items: 1. Maximum items: 500.

Example: two
{
  "ids": [
    "0b6f2c1e-4a1e-4a5f-9b8a-2f5f0d9c1a77",
    "7c1d9e20-3b4a-4f2e-8d1c-5a6b7c8d9e0f"
  ]
}

Responses

200

OK

Content type application/json.

Schema: AddressBookDeleted.

400

Malformed request

Content type application/json.

Schema: Error.

401

Invalid key or IP not allowed

Content type application/json.

Schema: Error.

429

Rate limit exceeded (rate_limited), or too many failed authorizations from this credential (too_many_auth_failures). Both are 429 and both carry Retry-After; they differ in what you should do about it, which is why they differ in code and not only in message. rate_limited also carries the RateLimit-* state of the bucket it came from; too_many_auth_failures does not, because the counter behind it is not a bucket. See "Rate limits" and "Repeated authorization failures" above.

On POST /orders a rate_limited may also carry details.reason = bulk_volume_cap: not requests per minute but energy per window — a mode c order whose volumes would take your account past the bulk allowance. details carries cap_units (the allowance), spent_units (your volume already inside the window), requested_units (what this order asked for) and window_s (the width of the window, 3600). Retry-After is the first instant at which this body can be accepted: enough of your counted volume has to leave the window to make room for requested_units, which is not in general the moment the oldest position leaves — one departure frees only that position's units. An order whose own volume is larger than the whole allowance is not answered here at all: no waiting would help it, and it is 400 invalid_request with details.reason = bulk_order_over_cap. It is a pace limit like the others, so it is the same code: the order is not wrong, and the same body sent later is accepted. It carries no RateLimit-* headers: those describe a bucket of requests per minute, and this allowance is energy per hour — details above is its whole state.

Content type application/json.

Schema: Error.

HeaderTypeDescription
Retry-Afterinteger

Seconds to wait before retrying.

RateLimit-Limitinteger

Requests per minute in this bucket — per UTC day on POST /sandbox/deposit, the one allowance in this API that is not counted per minute. Absent in exactly three cases, and in none is a number invented for it: the limiter could not read the bucket state (the request is let through then), the answer is too_many_auth_failures, which is counted by the authorization-failure counter and not by a bucket — see "Repeated authorization failures" — or it is the volume allowance (details.reason = bulk_volume_cap), which is energy per hour rather than requests per minute.

RateLimit-Remaininginteger

Requests left in this bucket right now.

RateLimit-Resetinteger

Seconds until the bucket is full again.