Choose a credential
| Credential | Use it when | How |
|---|---|---|
| OAuth | The client supports remote MCP sign-in (Claude, ChatGPT, Grok Bot, Claude Code). | Give the client only the URL. You sign in to Trustline, tick the permissions, press Allow. Access tokens last 1 hour and refresh for 30 days. |
| API key (tlk_...) | The client takes a header (Cursor, VS Code, the xAI API, scripts). | Create one in the dashboard under API & Agents, or let a headless agent get one (below). Send Authorization: Bearer tlk_... |
Either way, each permission is one scope: tl:read, tl:create, tl:update, tl:send, tl:delete. Grant only what the agent needs; a missing scope is reported, not guessed. Keep keys in environment variables, not in files you commit.
Claude Code
Sign in with OAuth:
claude mcp add --transport http trustline https://trustline.app/api/mcp
# then run /mcp in Claude Code and sign in to TrustlineOr use an API key from the environment:
claude mcp add --transport http trustline https://trustline.app/api/mcp \
--header "Authorization: Bearer $TRUSTLINE_API_KEY"Claude Desktop and claude.ai
Open Settings, Connectors, add a custom connector with the URL below, then sign in to Trustline and choose the permissions. There is no key to copy.
https://trustline.app/api/mcpChatGPT
Add a custom MCP server with OAuth, then mention @Trustline in a chat. ChatGPT asks you to confirm each tool that changes something. The full walkthrough, with the consent screen and how to disconnect: Connect ChatGPT.
Name Trustline
Server URL https://trustline.app/api/mcp
Authentication OAuthGrok
Grok Bot can add the server itself. With OAuth:
AddMcpServer {"name":"trustline","url":"https://trustline.app/api/mcp"}With an API key (for example one it got through the headless flow below):
AddMcpServer {"name":"trustline","url":"https://trustline.app/api/mcp","headers":{"Authorization":"Bearer <tlk_ key>"}}The xAI API's remote MCP tool sends a static key and has no OAuth flow. Add this to your request's tools:
"tools": [
{
"type": "mcp",
"server_url": "https://trustline.app/api/mcp",
"server_label": "trustline",
"authorization": "<tlk_ key>"
}
]Step by step, including the headless path: Connect Grok.
Cursor
Add this to .cursor/mcp.json in a project, or ~/.cursor/mcp.json for all projects, with the key in TRUSTLINE_API_KEY:
{
"mcpServers": {
"trustline": {
"url": "https://trustline.app/api/mcp",
"headers": {
"Authorization": "Bearer ${env:TRUSTLINE_API_KEY}"
}
}
}
}VS Code
VS Code reads .vscode/mcp.json:
{
"servers": {
"trustline": {
"type": "http",
"url": "https://trustline.app/api/mcp",
"headers": { "Authorization": "Bearer tlk_..." }
}
}
}Any HTTP client
The endpoint is plain JSON-RPC over HTTP POST, so curl works for a quick check. A request without a protocol version is served as an older client would be, which is fine for this:
curl -s https://trustline.app/api/mcp \
-H "Authorization: Bearer $TRUSTLINE_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"tl_read","arguments":{"op":"account"}}}'
# -> {"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"text","text":"{\"plan\":...,\"canSend\":true,...}"}]}}The same ops are on the REST API too: POST https://trustline.app/api/v1/ops/{op} with the op's arguments as the JSON body. See REST.
Headless: get a key
An agent without a browser can ask for its own key. A person approves once from an email; that click also creates their account if they have none. The key arrives once.
curl -s https://trustline.app/oauth/device_authorization \
-d email=<person's email> -d agent_name="My agent" \
-d scope="tl:read tl:create tl:send" -d credential=api_key
# show the person the user_code; they approve from the emailed link
curl -s https://trustline.app/oauth/token \
-d grant_type=urn:ietf:params:oauth:grant-type:device_code -d device_code=<device_code>
# every interval seconds until it stops answering authorization_pending
# -> {"access_token":"tlk_...","token_type":"Bearer","credential":"api_key",...} (once)Details, limits and the OAuth-token variant: self-onboarding.
First send
Send a test envelope to your own account email. An envelope whose only signer is you sends even before the 14-day trial starts, so this works on a new account:
tl_create {"op":"create","args":{"title":"Trustline test","text":"This is a test document.",
"signers":[{"name":"<your name>","email":"<your account email>"}],"send":true}}
// -> {"id":"env_...","status":"sent","signers":[{"id":"sgn_...","email":"...","order":1,"status":"notified","turn":true}]}
tl_read {"op":"status","args":{"id":"env_..."}} // sent -> completed once you sign from the email
tl_read {"op":"download","args":{"id":"env_..."}} // {pdf, cert}: one-hour URLs once completedOpen the email from Trustline and sign. Clients on MCP 2026-07-28 can wait for the envelope.completed event instead of checking status: see the events reference. To send to someone else, the account needs a plan: the first such send returns plan_required with a checkout link for the person.
Troubleshooting
- 401 with error="invalid_token": the token expired or was revoked. OAuth clients reconnect; with a key, check it under API & Agents.
- 403 insufficient_scope: the credential lacks the scope the tool needs (
data.scope). Reconnect and tick it, or create a key with it. - plan_required (402): give
details.checkoutUrlto the person; retry after they start the trial. - events/poll is method not found: the client speaks an older protocol revision. Poll
tl_read statusinstead.
Everything else: errors reference.