Skip to content
Terra WalletDevelopers

Early access. The Terra API and SDKs may change before launch, and the SDK packages are not published yet.

View as Markdown

API reference

Early access

API reference

Base URL for server-to-server calls: https://terrawallet.us/api/v1. Authenticate with Authorization: Bearer tw_..._sk_... (see Authentication).

Resources#

ResourceOperationsSummary
Partner account and session27Sign-up, sign-in, two-factor authentication and the current user. The dashboard calls these routes on its own origin with a session cookie; server integrations never call them.
Organizations and members11An organization owns projects, keys and every Terra Pay object. Members have one of six roles.
Projects and allowed origins6A project groups keys and settings inside an organization. Allowed origins lock publishable keys to your own https sites.
API keys5Secret keys for your server and publishable keys for the browser, per project and environment.
Audit logs1Every write in your organization, with actor, action, target, IP as stored, request id and time. Never secrets.
Payout wallets2The merchant's own wallets that customers pay into. Changes are locked down: an authenticator code, email confirmation, then a 24-hour cooldown.
Payment intents1One payment for one amount. Terra quotes an exact crypto amount per accepted asset, the customer pays from their own wallet to yours, and the intent succeeds only on verified chain data.
Payment links1Reusable, no-code links with a fixed or customer-chosen amount.
Invoices2Line items, a due date and a hosted invoice page.
Plans1A price and an interval for subscriptions (pay each period).
Subscriptions1A customer on a plan. In v1 every subscription is pay each period: Terra sends a renewal invoice each period and the customer pays it from their own wallet.
Refunds1Refund drafts. Terra never moves funds: the merchant signs and sends the refund from their own wallet, and the server only verifies it on chain.
Public checkout3The routes the hosted pages on pay.terrawallet.us use. No authentication, strict per-IP limits, and only what the page needs.
Webhook endpoints1Where Terra sends signed events. https only, with SSRF protection on every delivery.

Conventions#

  • Amounts are decimal strings ("10.50"), never floats. currency is a fiat ISO code; crypto assets are {chain, symbol, contract, decimals}; on-chain amounts are integer base units in strings.
  • Ids are prefixed and opaque: org_, proj_, key_, usr_, pi_, plink_, inv_, plan_, sub_, cus_, whe_, evt_, ses_.
  • Errors: {"error":{"code","message","requestId"}}. See Errors.
  • Every create needs an Idempotency-Key. See Idempotency.
  • Lists use cursors (limit, starting_after). See Pagination.
  • Unknown fields are rejected. Every string has a size cap.

Common errors#

StatusCodeWhen
401INVALID_API_KEYThe key is malformed, unknown, expired or revoked. Every case gets the same response.
403INSUFFICIENT_SCOPEThe key does not carry the scope the route needs.
403PRODUCT_DISABLEDThe product behind the route is switched off for the platform.
403LIVE_DISABLEDA live-mode action while live mode is not enabled.
404The object does not exist or belongs to another organization. The two cases look the same.
409IDEMPOTENCY_KEY_REUSEDAn Idempotency-Key was reused with a different body.
429RATE_LIMITEDToo many requests for this key or organization.
503MAINTENANCEPlatform maintenance. /v1/auth/* and /v1/me stay available.