# X-Trade AI for agents > Pay-per-result foreign-trade sales capabilities for AI agents: find buyers abroad, profile and research their companies, check what they import, find decision-makers and reveal their verified emails or mobiles. One API key, prepaid points, no subscription. Works over HTTP or MCP. These are setup instructions for you, the agent. Follow them in order. Updated: 2026-12-02 Page for humans: https://www.xtradebo.com/agents ## 1. Get an API key 1. Check whether the key is already set: `test -n "$XTRADE_API_KEY" && echo set`. 2. If it is not set, ask your human for an X-Trade AI API key. They create it in ai-sales under Settings → 开放接口 (Open API): https://ai-sales.xtradebo.com/settings/openApi. Only an account owner or admin can create keys, and the key is shown once. If they have no ai-sales account, they sign up at https://ai-sales.xtradebo.com/settings/openApi?signup=1 (a new phone number gets 50 free points and lands on the key page); if sign-up is closed there, they apply for access at https://www.xtradebo.com/agents. 3. Have them store it as the environment variable `XTRADE_API_KEY` (keys start with `xtk_live_`), then restart you so you inherit it. Never print the key, put it in a URL, or write it into a file that gets committed. ## 2. Basics - Base URL: https://ai-sales.xtradebo.com/v1 - Every request: `Authorization: Bearer $XTRADE_API_KEY` - Request and response bodies are JSON. - Most calls are synchronous and some take a minute. Allow up to 200 seconds per request (`curl --max-time 200`). Capabilities marked asynchronous answer at once and finish in the background (section 4). - Prices are in points. 1 point = CNY 0.1. The organization holds a prepaid balance. - A key can only call the capabilities it was granted, and is limited per minute (60 calls by default). ## 3. Discover capabilities and check the balance - `GET /v1/catalog?q=` returns `{"capabilities":[...]}`. Each entry has `id`, `title`, `summary`, `price` (`unit`, `points`, `maxUnits`), `typicalLatencyMs`, `inputSchema` (JSON Schema), `outputSchema` and `example.input`. Omit `q` to list everything. - `GET /v1/catalog/` returns one entry. Its `inputSchema` is authoritative; read it before your first call to a capability. - `GET /v1/balance` returns `balance`, `held` (reserved by running calls), `available`, `todaySpent` and `dailyCap` (null = no cap). ```sh curl -sS "https://ai-sales.xtradebo.com/v1/catalog?q=email" -H "Authorization: Bearer $XTRADE_API_KEY" curl -sS https://ai-sales.xtradebo.com/v1/balance -H "Authorization: Bearer $XTRADE_API_KEY" ``` ## 4. Call a capability `POST /v1/call/` - The body is the capability input itself, e.g. `{"website":"acme-tools.de"}`. Do not wrap it in `{"input": ...}`. - Always send `Idempotency-Key` with a fresh value (1-128 visible ASCII characters) for each logical request, and reuse that value when you retry the same request. A retry with the same key and body never charges twice: a finished call comes back with `"replayed": true`. The same key with a different body is rejected with 400. - Success is HTTP 200 with `{"callId", "capability", "status": "succeeded", "output", "units", "pointsCharged", "balanceAfter", "servedVia", "replayed"}`. - Response headers: `X-Points-Cost` (points this request charged), `X-Points-Balance` (balance afterwards), `X-Call-Id`. - Before running, the gateway holds price × maximum units from the available balance. Afterwards it charges only the units actually delivered and releases the rest. Example: find_customers with limit 10 holds 30 points; if 7 companies come back, it charges 21. - A failed call is never charged; any hold is fully released. If the connection drops or times out, do not start a new call with a new key: - If you have the call id (`X-Call-Id`, or `error.callId`), fetch the result with `GET /v1/calls/`. This is free. While the call is still running it answers 409 `in_progress`. - Otherwise resend the identical request with the same `Idempotency-Key`. You get the stored result, or 409 `in_progress` with `error.callId`. - `GET /v1/calls?cursor=` lists the organization's recent calls. ### Asynchronous capabilities Some capabilities take minutes or wait for data to come back (their catalog entry has `"mode": "async"`): - `POST /v1/call/` holds the points and answers 202 at once with `{"callId", "capability", "status": "queued", "retryAfterSec", "pointsHeld", "createdAt"}`. Headers: `X-Call-Id`, `X-Points-Held`, `Location: /v1/jobs/`, `Retry-After`. - Poll `GET /v1/jobs/` (free). While `status` is `queued` or `running`, wait `retryAfterSec` seconds (also sent as `Retry-After`) and ask again; `progress` may say what it is doing. `succeeded` has the same shape as a synchronous result; `failed` has `error` and was fully refunded. - Resending the same request with the same `Idempotency-Key` while it runs returns 202 with the same `callId`; it never starts a second job. - An organization can have 2 asynchronous calls queued or running at once; more are rejected with 429 `too_many_jobs`. A reveal waiting for a mobile number does not count. - Do not block on a long job. Tell your human it is running, carry on with other work, and check back. ```sh JOB=$(IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid) curl -sS --max-time 200 -X POST https://ai-sales.xtradebo.com/v1/call/trade.company_research \ -H "Authorization: Bearer $XTRADE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $IDEM" \ -d '{"company":"Acme Tools GmbH","website":"acme-tools.de","country":"Germany"}' | jq -r .callId) curl -sS https://ai-sales.xtradebo.com/v1/jobs/$JOB -H "Authorization: Bearer $XTRADE_API_KEY" ``` ## 5. Errors Every error body looks like `{"error":{"code":"...","message":"...","retryAfterSec":30,"callId":"call_..."}}`. `retryAfterSec` and `callId` appear only when relevant. Failed calls are never charged. - 400 `invalid_input`: fix the body against `inputSchema` from `GET /v1/catalog/`. Do not resend it unchanged. - 401 `unauthorized`: the key is missing, wrong or revoked. Ask your human for a working key. - 402 `insufficient_points`: stop. Tell your human the cost and the available balance (`GET /v1/balance`) and ask them to top up. Do not retry in a loop. - 403 `forbidden_capability`: this key was not granted that capability. Ask your human to enable it on the key in Settings → 开放接口. - 404 `unknown_capability`: the id does not exist or is not live yet. Check `GET /v1/catalog`. - 409 `in_progress`: the call with this `Idempotency-Key` is still running. Wait 15-30 seconds, then `GET /v1/calls/`. - 429 `rate_limited`: wait `retryAfterSec` (also sent as `Retry-After`), then retry with the same `Idempotency-Key`. - 429 `daily_cap_reached`: the organization's daily spending cap is used up until midnight Beijing time. Tell your human; do not keep retrying. - 429 `quota_exceeded`: this capability's daily allowance for the organization is used up until midnight Beijing time. Nothing was held or charged. Tell your human; try again tomorrow. - 429 `too_many_jobs`: too many asynchronous calls are already running. Wait for one to finish (`GET /v1/jobs/`), then retry with the same `Idempotency-Key`. - 502 `upstream_failed`: it failed on our side and was fully refunded. Retry later, at most twice, then report the message to your human. - 503 `balance_unavailable`: nothing ran and nothing was charged. Retry in a minute. - 500 `internal_error`: if the error has a `callId`, check `GET /v1/calls/` before you retry. ## 6. Spend carefully - Estimate first: price × units (see the capabilities below), and compare it with `available` from `GET /v1/balance`. If a plan would spend more than your human expects, tell them the estimate and wait for a yes. - Start small. Run find_customers with `limit` 5 first and widen only if the results fit. - Keep results locally. Do not profile the same company twice, and pass the domains you already have as `excludeDomains`. - Remove duplicate addresses before verifying. - Deep research, import background and mobile numbers cost much more than a profile. Run them only on companies and people your human has shortlisted, and say the total first. - Look for decision-makers only at companies you kept, and reveal contacts only for the people you would actually write to. - When you finish, tell your human what you called, the total points charged (sum of `X-Points-Cost`) and the remaining balance. ## 7. Live capabilities ### trade.find_customers (Find customers) Say what you sell and which buyers in which countries. Get real companies with websites, with directories, associations and competitors removed, each with a fit score and source. Price: 3 points per company (CNY 0.3). Billed per company returned, up to 25 per call. Held before the run: 3 points × limit. Typical time: about 60 s. Input: - `product` (string, required): what you sell, e.g. "diamond saw blades". - `countries` (array of 1-3 English country names, required): each country is searched separately. - `customerTypes` (optional): any of importer, distributor, wholesaler, retailer, manufacturer, end_user. Default importer, distributor, wholesaler. Competitors are always excluded. - `keywords` (optional, 1-6 strings): search keywords, ideally in the local language. Default: product plus the first customer type. - `limit` (integer 1-25, default 10): maximum companies to return. - `excludeDomains` (optional, up to 500): domains you already have; they are never returned. Output (`output` in the response): - `companies[]`, sorted by fitScore: `name`, `website`, `country`, `type` (importer, distributor, wholesaler, retailer, manufacturer, end_user, service or other), `fitScore` (0-100), `evidenceUrl`, `evidence` (why it matches, in Simplified Chinese). ```sh IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid) curl -sS --max-time 200 -X POST https://ai-sales.xtradebo.com/v1/call/trade.find_customers \ -H "Authorization: Bearer $XTRADE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $IDEM" \ --dump-header /dev/stderr \ -d '{"product":"diamond saw blades","countries":["Germany"],"customerTypes":["distributor","wholesaler"],"limit":5}' ``` ### trade.company_profile (Company profile) Give a website. Get what the company does, its product categories, size signals, and whether it is a competitor or a retailer. Price: 3 points per company (CNY 0.3). Held before the run: 3 points. Typical time: about 25 s. Input: - `website` (string, required): company website URL or bare domain, e.g. acme-tools.de. - `company` (string, optional): company name if known. - `ourProducts` (string, optional): what you sell, used to judge whether this company is a competitor. Default: the product profile in the account settings. - `language` ("zh" or "en", default "zh"): language of the text fields. Send "en" unless the human reads Chinese. Output (`output` in the response): - `company`, `website`, `whatTheyDo`, `productCategories[]`, `businessType`, `sizeSignals[]`, `isCompetitorGuess` (boolean), `isRetailerGuess` (boolean), `evidenceUrl`. ```sh IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid) curl -sS --max-time 200 -X POST https://ai-sales.xtradebo.com/v1/call/trade.company_profile \ -H "Authorization: Bearer $XTRADE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $IDEM" \ --dump-header /dev/stderr \ -d '{"website":"https://www.example-tools.de","language":"en"}' ``` ### trade.verify_email (Verify emails) Check each address before outreach. Each result is valid, invalid, catch-all or unknown. Price: 0.5 points per email (CNY 0.05). Free when the account uses its own email-verification key. Up to 20 per call; duplicates count once. Held before the run: 0.5 points × number of unique emails. Typical time: about 4 s. Input: - `emails` (array of 1-20 addresses, required). Duplicates are verified and billed once. Output (`output` in the response): - `results[]`: `email`, `result` (valid, invalid, catch-all or unknown), `status` (raw verifier status), `isRoleAddress` (generic mailbox such as info@), `verified` (false means this address could not be checked and was not billed). ```sh IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid) curl -sS --max-time 200 -X POST https://ai-sales.xtradebo.com/v1/call/trade.verify_email \ -H "Authorization: Bearer $XTRADE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $IDEM" \ --dump-header /dev/stderr \ -d '{"emails":["john.doe@example.com"]}' ``` ### trade.company_research (Deep research) A research report on the business, categories, buying signals, fit and a suggested opening. Runs in the background, usually 4-7 minutes. Price: 15 points per company (CNY 1.5). Fully refunded when nothing useful is found. Held before the run: 15 points. Asynchronous: the call answers 202 with a `callId` right away; poll `GET /v1/jobs/` (see section 4). Typical time: about 5 min. Input: - `company` (string, required): company name, e.g. "Acme Tools GmbH". - `website` (string, optional): website or domain; found automatically when omitted. - `country` (string, optional): country of the company. - `ourProducts` (string, optional): what you sell, used for the fit analysis and the suggested opening. Default: the product profile in the account settings. Output (`output` in the response): - `company`, `website`, `country`, `businessSummary`, `customerType`, `ownBrand`, `productCategories[]`, `products[]` (`name`, `category`, `uses`), `buyingSignals[]` (`type`, `detail`, `sourceUrl`). - `fit`: `summary`, `productMatches[]` (`theirSpec`, `ourLine`, `note`), `incumbentSuppliers[]` (`name`, `evidence`), `switchingDifficulty` (high, medium, low or unknown). - `suggestedApproach`, `keyPeople[]` (`name`, `title`, no contact details), `risks[]` (`type`, `description`), `reportMarkdown` (the full report, in Simplified Chinese), `sources[]`. ```sh IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid) curl -sS --max-time 200 -X POST https://ai-sales.xtradebo.com/v1/call/trade.company_research \ -H "Authorization: Bearer $XTRADE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $IDEM" \ --dump-header /dev/stderr \ -d '{"company":"Acme Tools GmbH","website":"acme-tools.de","country":"Germany"}' ``` ### trade.import_background (Import background) Whether a company really imports, what, from which countries, at what volume and trend. Conclusions only, no raw bills of lading. Price: 20 points per company (CNY 2). Not charged when the company is not found in customs data. Free when the account uses its own customs-data account; on ours, up to 20 companies per organization per day. Held before the run: 20 points. Typical time: about 20 s. Input: - `company` (string, required): company name as it appears on shipping documents, e.g. "Acme Tools GmbH". - `country` (string, required): country of the company (English name, Chinese name or ISO code). - `domain` (string, optional): company domain if known; helps match name variants. Output (`output` in the response): - `found` (false = not in customs data, not charged), `matchedName`, `matchedCountry`, `role` (importer, exporter, both or unknown), `isImporter`. - `shipments` (range over the latest 500 records: 1-9, 10-49, 50-199, 200-499, 500+), `valueUsd` (range: <100K, 100K-1M, 1M-10M, 10M-50M, 50M+ or unknown), `period` (`from`, `to`, YYYY-MM). - `topHsChapters[]` (`chapter`, `name`, `nameZh`, `share`), `originCountries[]` (`country`, `share`), `monthlyTrend[]` (`month`, `shipments` range), `topSuppliers[]` (names). ```sh IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid) curl -sS --max-time 200 -X POST https://ai-sales.xtradebo.com/v1/call/trade.import_background \ -H "Authorization: Bearer $XTRADE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $IDEM" \ --dump-header /dev/stderr \ -d '{"company":"Acme Tools GmbH","country":"Germany","domain":"acme-tools.de"}' ``` ### trade.find_decision_makers (Find decision-makers) Find buyers, owners and other decision-makers at a company, with name, title and LinkedIn. Price: 1 point per call (CNY 0.1). Free when the account uses its own contact-data key. Held before the run: 1 points. Typical time: about 6 s. Input: - `domain` (string, required): company domain or website, e.g. acme-tools.de. - `company` (string, optional): company name; used to drop people who only used to work there. - `titles` (optional, up to 10 strings): job titles to look for, e.g. ["purchasing manager","buyer"]. Owners, founders, executives and directors are always included. - `limit` (integer 1-25, default 10): maximum people to return. Output (`output` in the response): - `domain`, `people[]`: `personId` (pass to trade.reveal_contact or trade.reveal_phone within 30 days), `name` (last name may be partly masked), `title`, `linkedin`, `hasEmail`, `hasDirectPhone` (null = unknown). ```sh IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid) curl -sS --max-time 200 -X POST https://ai-sales.xtradebo.com/v1/call/trade.find_decision_makers \ -H "Authorization: Bearer $XTRADE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $IDEM" \ --dump-header /dev/stderr \ -d '{"domain":"acme-tools.de","titles":["purchasing manager"],"limit":5}' ``` ### trade.reveal_contact (Reveal email) Get a decision-maker's work email, verified before it counts. Price: 10 points per verified email (CNY 1). Charged only when the address verifies as deliverable; catch-all, unknown and not found are free. Only for people found with trade.find_decision_makers in the last 30 days. Held before the run: 10 points. Typical time: about 8 s. Input: - `personId` (string, required): from trade.find_decision_makers, within 30 days. Output (`output` in the response): - `personId`, `name`, `title`, `email` (null when none), `emailStatus` (valid = deliverable and charged; catch-all or unknown = returned unconfirmed, free; invalid or not_found = nothing usable, free). ```sh IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid) curl -sS --max-time 200 -X POST https://ai-sales.xtradebo.com/v1/call/trade.reveal_contact \ -H "Authorization: Bearer $XTRADE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $IDEM" \ --dump-header /dev/stderr \ -d '{"personId":""}' ``` ### trade.reveal_phone (Reveal mobile) Get a decision-maker's mobile number. It arrives asynchronously, within 48 hours. Price: 50 points per mobile number (CNY 5). Charged only when a number arrives; fully refunded after 48 hours without one. Only for people whose hasDirectPhone is not false; up to 20 per organization per day. Held before the run: 50 points. Asynchronous: the call answers 202 with a `callId` right away; poll `GET /v1/jobs/` (see section 4). Typical time: about 10 min. Input: - `personId` (string, required): from trade.find_decision_makers, within 30 days. Output (`output` in the response): - `personId`, `phone` (null = no number found, not charged). ```sh IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid) curl -sS --max-time 200 -X POST https://ai-sales.xtradebo.com/v1/call/trade.reveal_phone \ -H "Authorization: Bearer $XTRADE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $IDEM" \ --dump-header /dev/stderr \ -d '{"personId":""}' ``` ## 8. A worked flow: from product to an outreach list 1. Find customers. Start with a small limit. ```sh IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid) curl -sS --max-time 200 -X POST https://ai-sales.xtradebo.com/v1/call/trade.find_customers \ -H "Authorization: Bearer $XTRADE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $IDEM" \ --dump-header /dev/stderr \ -d '{"product":"diamond saw blades","countries":["Germany"],"customerTypes":["distributor","wholesaler"],"limit":5}' > companies.json jq -r '.output.companies[] | "\(.fitScore)\t\(.website)\t\(.name)"' companies.json ``` 2. Profile the top 3 by `fitScore`, one call per website. Drop any with `isCompetitorGuess` or `isRetailerGuess` true, unless your human wants retailers. ```sh for site in $(jq -r '.output.companies[:3][].website' companies.json); do IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid) curl -sS --max-time 200 -X POST https://ai-sales.xtradebo.com/v1/call/trade.company_profile \ -H "Authorization: Bearer $XTRADE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $IDEM" \ -d "{\"website\":\"$site\",\"language\":\"en\"}" echo done ``` 3. Find decision-makers at the companies you kept (one call per domain), then reveal the email of the right person. Only a deliverable (`"emailStatus": "valid"`) address is charged; catch-all and unknown come back unconfirmed and free. ```sh IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid) curl -sS --max-time 200 -X POST https://ai-sales.xtradebo.com/v1/call/trade.find_decision_makers \ -H "Authorization: Bearer $XTRADE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $IDEM" \ --dump-header /dev/stderr \ -d '{"domain":"example-tools.de","titles":["purchasing manager","buyer"],"limit":5}' > people.json PID=$(jq -r '.output.people[0].personId' people.json) IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid) curl -sS --max-time 200 -X POST https://ai-sales.xtradebo.com/v1/call/trade.reveal_contact \ -H "Authorization: Bearer $XTRADE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $IDEM" \ --dump-header /dev/stderr \ -d '{"personId":"'"$PID"'"}' ``` If you already have addresses from contact pages or from your human, verify them in one call (up to 20) and keep only `"result": "valid"`. ```sh IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid) curl -sS --max-time 200 -X POST https://ai-sales.xtradebo.com/v1/call/trade.verify_email \ -H "Authorization: Bearer $XTRADE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $IDEM" \ --dump-header /dev/stderr \ -d '{"emails":["info@example-tools.de","sales@example-tools.de"]}' ``` 4. Hand your human the list: company, website, what they do, fit score, the people and their verified addresses, and the points spent. ## 9. MCP The same capabilities are available as an MCP server (streamable HTTP, no session state): https://ai-sales.xtradebo.com/mcp. Every request carries `Authorization: Bearer $XTRADE_API_KEY`. If your client supports MCP, prefer it; ask your human to add it once: - Claude Code: `claude mcp add --scope user --transport http xtrade https://ai-sales.xtradebo.com/mcp --header "Authorization: Bearer $XTRADE_API_KEY"` - Codex: `codex mcp add xtrade --url https://ai-sales.xtradebo.com/mcp --bearer-token-env-var XTRADE_API_KEY` - Others: add an HTTP (streamable) MCP server named `xtrade` with that URL and header. Each capability the key was granted is one tool, named after its id with dots replaced by underscores (`trade.find_customers` → `trade_find_customers`). Two more tools are free: `balance` and `job_result` (`{"callId": "..."}`), which fetches the result of an asynchronous tool or of a call whose answer was lost. Prices, holds and errors are the same as over HTTP. MCP calls cannot carry an `Idempotency-Key`: if a tool call breaks before you see its result, find it with `GET /v1/calls` over HTTP and fetch it with `job_result` instead of calling the tool again. ## 10. Coming soon (not callable yet) These are announced with their prices. Calling them now returns 404 `unknown_capability`. Check `GET /v1/catalog` to see when they go live. - `whatsapp.connect` (WhatsApp hosting): Connect your WhatsApp by QR code. AI answers inbound customer messages from your own material. Price: no charge per connection; 2 points per AI-hosted reply (CNY 0.2). Replies to inbound messages only; never sends first.