Documentation
API and agent quickstart
Search tools, find offers, and plan a build without an account. Add a workflow token only for private saved work.
Agents: read the manifest or SKILL.md, then use the tool matching the task. Start with search_tools, find_perks, or build_brief.
Try one public request
curl "https://tokensand.com/api/directory/context?q=private%20project%20tracker&limit=3"Use returned docs and source labels. Keep the receipt ID for a later requested save; reading or copying a plan does not save it. build_brief produces an unsaved plan. Save in the workbench before using get_build_packet.
Offers and private work
- Offers:
find_perksdiscovers opportunities. Read provider eligibility, expiry, and billing terms before applying. Native Tokens& claims require a signed-in browser session;DAI_TOKENdoes not authenticate claims. A Tokens& claim or provider link does not prove credit approval or redemption. - Private context: sign in once to create a revocable
DAI_TOKEN. Browser login is not inherited by an MCP host. Project tokens read one project; developer publishing tokens support the documented write flows. See auth and scopes. - Autonomy: continue authorized discovery and local implementation. Review a draft before an explicit public publication. Provider account creation, paid usage, legal acceptance, or external messages need the user's authorization for that action.
- Recovery: fix invalid input on 400; check credentials on 401 and scope on 403. On 429, honor any
Retry-Afterand back off. Do not blindly retry writes after an uncertain response; inspect what persisted first.
Tracking keys use TOKENSAND_ADOPTION_KEY; workflow tokens use DAI_TOKEN. They are not interchangeable. Keep both out of browsers and public files.
Open the reference section needed for your task.
Set up server-side tracking
- 1. Create a tracking key. Open the company workspace, choose the product, and store the key on your server.
- 2. Validate one event. Use the dry-run examples. Check
accepted: true, the product, account and campaign mapping. - 3. Store and verify. Send an approved real event to
/api/usage/track. Confirmtracked: trueand its event ID, then find it in your workspace.
Use a stable source event ID as idempotencyKey; reuse it only for retries of that event. A retry with duplicate: true refers to the existing event. A 2xx response alone does not prove storage. An ignored product can return tracked: false.
Validate an event with REST
These examples validate without storing an event. Replace sample identifiers and review the returned mapping before a real write.
Example
Validate an event with cURL
# Set TOKENSAND_ADOPTION_KEY in your server environment first.
curl --fail-with-body https://tokensand.com/api/usage/track/dry-run \
-H "Authorization: Bearer $TOKENSAND_ADOPTION_KEY" \
-H "Content-Type: application/json" \
-d '{
"event_name": "FIRST_API_CALL",
"event_family": "activation",
"developer_id": "dev_123",
"account_domain": "customer.example",
"product": {
"id": "your-api",
"name": "Your API",
"type": "api"
},
"context": {
"attribution": {
"campaignId": "your-campaign-id",
"source": "workshop"
}
},
"idempotencyKey": "source-event-123"
}'Endpoints and authentication
Base URL: https://tokensand.com. Read exact request and response schemas in OpenAPI.
GET /api/directory/context
Fetch live DB-backed tool rows, facets, tracked action URLs, and receipt metadata for agent answers. Auth: Public or session.
GET /api/build/search
Search builder stack recommendations by intent, pricing, maturity, category, and proof signals. Auth: Public, rate-limited.
POST /api/usage/track/dry-run
Validate payload shape, required identifiers, and account mapping without storing the event. Auth: Tracking key.
POST /api/usage/track
Store one activation, retention, commercial, or expansion event for a company product. Auth: Tracking key.
POST /api/usage/track/batch
Store up to 500 events from batch jobs, warehouses, CDPs, campaign imports, or event platforms. Auth: Tracking key.
GET /api/v1/adoption
Read public, privacy-safe adoption rows for tools, categories, proof, and rankings. Auth: Public, rate-limited.
GET /api/v1/agent-rank
Read the public adoption score contract for agent search, recommendation, and citation flows. Auth: Public, rate-limited.
401/403: verify token type and access. 400: correct the payload. 409: do not change an event under an existing idempotency key. 429: respect rate-limit headers before retrying. On an uncertain write, inspect what persisted before retrying. Reuse the same payload and key only where idempotency is documented.
Event fields, campaign mapping and CDP imports
Send event_name and one stable developer identifier. Organization tracking keys also require product and idempotencyKey (or event_id) for stored events. Add event_family for custom names.
account_domain- The customer account to match. Use the actual account, not the vendor sending the event.
context.attribution.campaignId- Your campaign identifier. A top-level
campaignIdis not part of the tracking schema. occurredAt- ISO 8601 time of the real event; preserve it on replay. Do not invent retention timestamps.
projectId- Optional existing Tokens& project ID for linked project proof. Omit it when no project exists.
For Segment/PostHog-style input, map event to event_name, userId to developer_id, and campaign properties into context.attribution. Send the canonical payload above, not the raw CDP envelope. Batch requests use {"events": [...]}, up to 500 events.
intent — Docs open, event RSVP, comparison, saved stack, pricing view.
evaluation — SDK init, API key created, demo project, benchmark, proof review.
activation — First API call, first successful workflow, project created.
retention — Returned D7/D30, repeated API calls, production-like usage.
expansion — Team added, account matched, more workflows or products adopted.
commercial — Credit claimed, perk redeemed, campaign sourced, opportunity created.
Usage receipt SDK reference
The server-side SDK writes the tokensand-usage-receipt-v1 contract into metadata.usageReceipt. The calls below store events; validate your integration first. Metrics are illustrative and must be replaced with observed values.
@tokensand/adoption@0.1.0 is not available on public npm. These examples are reference-only for teams supplied with the SDK. Use the REST quickstart above for setup; do not install or import an unavailable package. With a supplied SDK, trackUsageReceipt supports model, API, spend and build receipts.
import { tokensand } from "@tokensand/adoption";
const adoption = tokensand({
apiKey: process.env.TOKENSAND_ADOPTION_KEY!,
baseUrl: "https://tokensand.com"
});
// This SDK call stores an event. Replace every illustrative value with measured usage.
const result = await adoption.trackUsageReceipt<{ tracked?: boolean; duplicate?: boolean; ignored?: boolean }>({
receiptType: "model_call",
product: { id: "your-model", name: "Your model", type: "model" },
user: { id: "dev_123" },
account: { domain: "customer.example" },
workflow: { id: "support-agent", runId: "run_123", success: true },
provider: "your-provider",
model: "your-model",
inputTokens: 1200,
outputTokens: 340,
costCents: 12,
latencyMs: 820,
success: true,
idempotencyKey: "run_123:model-call-1"
});
if (!result.ok || (result.data?.tracked !== true && result.data?.duplicate !== true)) {
console.warn("Usage receipt was not stored; check the tracking response.");
}MCP telemetry SDK reference
The SDK is not available on public npm. These examples are reference-only for teams supplied with the SDK; use the REST quickstart for setup.
trackMcpToolCall records MCP_TOOL_CALL_SUCCEEDED / MCP_TOOL_CALL_FAILED. Stable context: mcpServer, mcpTool, workflow.id, account.domain. Supply a unique execution ID for retries and measured metrics.
Place telemetry beside the real server-side tool call. Never send raw prompts, secrets, private payloads, private code. A single sample receipt does not justify a recommendation to keep or replace a stack.
MCP wrapper
Any MCP server
import { tokensand } from "@tokensand/adoption";
const adoption = tokensand({
apiKey: process.env.TOKENSAND_ADOPTION_KEY!,
baseUrl: "https://tokensand.com"
});
// This SDK call stores an event. Use actual identifiers and measured metrics.
const result = await adoption.trackMcpToolCall<{ tracked?: boolean; duplicate?: boolean }>({
product: { id: "your-agent", name: "Your agent", type: "agent" },
user: { id: "dev_123" },
account: { domain: "customer.example" },
workflow: { id: "support-agent", runId: "run_123" },
mcpServer: "your-server",
mcpTool: "your-tool",
requestCount: 1,
latencyMs: 920,
success: true,
idempotencyKey: "run_123:tool-call-1"
});
if (!result.ok || (result.data?.tracked !== true && result.data?.duplicate !== true)) {
console.warn("MCP receipt was not stored; check the tracking response.");
}Partner relays and activation event names
Send events from the partner server with a company tracking key. Validate one payload, then send activation when it happens and reconcile account and cost counters. CSV is a fallback when server events are unavailable.
DOCS_MCP_CONNECTEDevaluation — Provider observed a docs MCP connection; a config copy alone is intent.
WEB_MCP_CONNECTEDevaluation — Builder connected the partner Web MCP server.
API_KEY_CREATEDevaluation — Builder created partner API credentials.
MCP_TOOL_CALL_SUCCEEDEDactivation — Agent successfully used a partner MCP tool.
FIRST_UNLOCKER_REQUEST_SUCCEEDEDactivation — First successful web access/API request.
SCRAPER_JOB_COMPLETEDactivation — Builder completed a scraping or data workflow.
ZONE_USAGE_REPORTEDretention — Partner reconciled account, zone, cost, or bandwidth usage.
RETURNED_AFTER_7_DAYSretention — Builder returned after initial activation.
ENTERPRISE_USAGE_THRESHOLD_REACHEDcommercial — Usage crossed an account or pipeline threshold.
Import SKILL.md as a private draft
Generate a developer workflow config from project setup. Skill imports require an unscoped workflow token with project:publish; project-scoped tokens are rejected. Use DAI_TOKEN, not a tracking key.
Parse a public SKILL.md, review the draft, then confirm creation with an idempotency key. This creates a private DRAFT. Public publishing remains a separate authenticated dashboard action after the install path is verified. Only import public content you may use; secrets and private repository files are not fetched.
# Replace this URL with a public SKILL.md that you own or may import.
# 1. Parse and review. This call returns persisted: false.
curl --fail-with-body https://tokensand.com/api/workflow/agent-skills \
-H "Authorization: Bearer $DAI_TOKEN" \
-H "Content-Type: application/json" \
-d '{"skillUrl":"https://raw.githubusercontent.com/your-org/your-repo/main/SKILL.md"}'
# 2. After approval, create a PRIVATE draft. Reuse the key for retries of this import.
curl --fail-with-body https://tokensand.com/api/workflow/agent-skills \
-H "Authorization: Bearer $DAI_TOKEN" \
-H "Idempotency-Key: skill-import-your-stable-source-id" \
-H "Content-Type: application/json" \
-d '{"skillUrl":"https://raw.githubusercontent.com/your-org/your-repo/main/SKILL.md","confirm":true,"status":"DRAFT"}'
# Expect persisted: true, an agentHref and publicHref: null.
# Public publishing is a separate authenticated dashboard action after install verification.Open the dashboard import formRead the public adoption graph
Public reads are rate limited and aggregate. Preserve methodology, source labels and cohort suppression. Missing rows are not proof of no adoption.
curl --fail-with-body "https://tokensand.com/api/v1/adoption?period=30d&limit=10"Keep evidence and private data distinct
- Keep raw prompts, private notes and secrets out of metadata.
- Keep workspace data private and rotate exposed keys.
- Preserve first-party, public-source, sample, modelled and missing labels in reports.
- Small cohorts remain suppressed or insufficient; do not infer individual identities.
- Sponsor selection is self-reported until authenticated activation arrives. Retained proof requires a separate signal at least seven days later.
Machine-readable docs and MCP setup
Start with the manifest and OpenAPI. Public lookup and build_brief need no token; private saved Build Packets require authorized workflow access. Installing MCP does not grant enterprise access.
# Public tools need no token. Pin the documented CLI version.
npx -y @dev-adoption/cli@0.1.12 mcp serve --api https://tokensand.com
# Claude Code registration
claude mcp add --transport stdio tokensand -- npx -y @dev-adoption/cli@0.1.12 mcp serve --api https://tokensand.com
# Set DAI_TOKEN through your host's secret environment only for private workflow access.Use Tokens& build_brief for this project: [describe the product and constraints].
Return the stack choices, alternatives, available credits, cost and reliability risks,
and a Build Packet with the next implementation step and proof needed.
Separate public evidence from assumptions. Do not claim that setup proves adoption.enterprise_session_brief analyzes supplied aggregate metrics or a labeled sample. It does not fetch live tenant data, even with enterprise credentials. Mode, organization and profile labels do not grant access. Its output does not prove reconciled spend or measured ROI; verify the underlying evidence.
Company next actions
DevRel: compare activation and returning users in campaigns. CMO: review account evidence in the adoption dashboard. Inspect competitor sources in War Map before acting.
Companies can start in the free workspace. Private attribution and governed exports require sales-enabled enterprise access. Setup, clicks and missing attribution are not proof of retained usage or revenue.
