---
title: "Building integrations in Cursor? Let a vendor run sign-in, token refresh and API changes (2026)"
slug: build-integrations-in-cursor-let-truto-run-auth-and-api-changes
date: 2026-12-01
author: Uday Gajavalli
categories: [Engineering, Guides]
excerpt: "Cursor and Claude Code write integration code fast. The parts that break after launch are each customer's OAuth sign-in, token refresh, rate limits and vendor API changes. Here is who should run them, and how the code calls one API."
tldr: "Keep writing integration logic in Cursor or Claude Code. Let a platform run each customer's OAuth sign-in, token refresh and vendor API changes. Truto does this for every connected account, so your code calls one API and handles rate limits from one standard set of headers."
canonical: https://truto.one/blog/build-integrations-in-cursor-let-truto-run-auth-and-api-changes/
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://truto.one/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Building integrations in Cursor? Let a vendor run sign-in, token refresh and API changes (2026)


Keep writing the integration logic in Cursor. Hand the parts that break after launch to a platform: each customer's OAuth sign-in, token refresh, vendor API changes and webhooks. Truto runs those for every connected account. Your Cursor code calls one API, and reads rate limits from one standard set of headers.

The rest of this post shows where that line falls, which vendors run the auth and upkeep part, and what the code looks like when Cursor or Claude Code writes it.

## What does Cursor write well in an integration?

Cursor and Claude Code are good at the code you can see in one file:

- The request to the vendor's endpoint, with the right fields.
- The mapping from the vendor's record to your own data model.
- The business rules: which records to sync, what to create, what to skip.
- Tests for that logic, against sample responses.

For one vendor and one test account, that is often all you need. A coding agent can produce a working HubSpot or Jira call in minutes.

## What still breaks after launch?

The trouble starts with the second customer, and gets worse with each new app. These are the jobs that do not live in one file. They run all day, for every account, and they fail when nobody is looking.

| Job | With Truto | Without a platform |
|---|---|---|
| Sign-in | Truto's approved OAuth apps, or your own | An OAuth app and app review per vendor |
| Token refresh | AES-256 at rest; refresh 60 to 180 s before expiry, one per account at a time | Encrypt tokens, refresh in time, stop two workers racing |
| Reconnect | Account marked `needs_reauth`; a webhook tells you | Learn of a dead token from a failed call |
| Rate limits | One `429` with `ratelimit-*` headers; your code retries | Learn each vendor's "slow down" |
| Pagination | Every list returns `next_cursor` | One parser per vendor |
| API changes | Truto fixes the integration; no deploy | Find out from errors, fix, redeploy |
| Webhooks | Verified per vendor, sent as signed events | Keep an endpoint up, check each signature |
| Custom fields | Override the mapping for one account | Fork the mapping per customer |

Two notes on that table.

First, Truto does not retry a rate-limited call for you. It gives your code the same `429` and the same headers for every vendor, so one retry function covers all of them. The [Truto Agent Skills](https://truto.one/blog/truto-agent-skills-stop-ai-hallucinations-when-building-integrations/) teach Cursor to write that function.

Second, token refresh is where most home-built integrations fail in production. Race conditions, revoked tokens and vendors that do not return a new refresh token are common. [Handling OAuth Token Refresh Failures in Production](https://truto.one/blog/handling-oauth-token-refresh-failures-in-production-for-third-party-integrations/) covers each case.

The full build-or-run comparison, with a cost model, is on [Build integrations with AI](https://truto.one/build-integrations-with-ai/).

## Which vendors run sign-in and token refresh for you?

Several kinds of product run the auth and upkeep part. They differ in what your code calls.

- **Unified API with a proxy: [Truto](https://truto.one/).** Call any app's own API through the [Proxy API](https://truto.one/proxy-api/), or one schema per category through the [unified APIs](https://truto.one/unified-apis/). Per-account MCP servers for agents. Missing apps are built from API docs with the [Truto CLI](https://truto.one/cli/).
- **Sync-first unified API: [Merge](https://www.merge.dev/).** A unified API for accounting, ATS, CRM, file storage, HR and ticketing, with [passthrough requests](https://docs.merge.dev/merge-unified/supplemental-data/passthrough-request/passthrough-requests) for the vendor's own endpoints. Merge [stores end-user data and credentials](https://help.merge.dev/en/articles/5389408-do-you-encrypt-data).
- **Real-time unified API: [Unified.to](https://unified.to/).** Unified APIs with passthrough, webhooks and MCP. Its site says it keeps no customer records at rest.
- **Embedded iPaaS: [Paragon](https://www.useparagon.com/).** Workflows embedded in your product, plus ActionKit tools for agents and [Managed Sync](https://docs.useparagon.com/managed-sync/overview).
- **Code-first framework: [Nango](https://www.nango.dev/).** You write each integration as code that runs on Nango's runtime, with auth, a proxy and MCP. It can be [self-hosted](https://github.com/NangoHQ/nango).
- **Managed auth and agent tools: [Pipedream Connect](https://pipedream.com/docs/connect).** Managed auth, prebuilt actions and triggers, an API proxy and MCP for agents.
- **Agent tools: [Composio](https://composio.dev/).** MCP and tools for AI agents, [priced per tool call](https://composio.dev/pricing).

Which one fits depends on what your code needs. If Cursor writes calls to many vendors' own endpoints, you want a proxy with managed auth. If your product reads the same kind of record from many apps, you want a unified API. If your customers build their own workflows, you want an embedded iPaaS. [The embedded iPaaS vs unified API playbook](https://truto.one/blog/the-b2b-saas-buyer-decision-playbook-embedded-ipaas-vs-unified-api/) goes deeper on that choice.

## What does it look like from Cursor?

Here is a full loop: give Cursor the Truto context, ask for a feature, and check the code it writes.

### 1. Give Cursor the Truto context

Add the Truto skills once. In Cursor, open **Settings**, then **Rules**, then **Add Rule**. Choose **Remote Rule (GitHub)** and enter `https://github.com/trutohq/truto-skills`.

In Claude Code, run:

```bash
/plugin marketplace add trutohq/truto-skills
/plugin install truto@truto-skills
```

Codex, Windsurf and other agents that read SKILL.md files use `npx skills add trutohq/truto-skills`. Any MCP client can also use the docs MCP server at `https://docs-mcp.truto.one/mcp`. The skills stop the agent from guessing endpoints, auth flows and pagination.

### 2. Ask for the feature

A prompt like this one works:

> Using the Truto skills, add CRM contact import. Add a backend route that mints a Truto link token for the current workspace. Then add a job that reads CRM contacts for each connected account through Truto's unified CRM API. Follow next_cursor to the end. On a 429, wait for Retry-After and try again. Keep TRUTO_API_TOKEN on the server.

### 3. Check the code

Cursor writes two parts. The first mints a link token, so your customer can connect their CRM through Truto's Connect UI:

```typescript
// Server only: TRUTO_API_TOKEN never goes to the browser.
export async function createLinkToken(workspaceId: string) {
  const res = await fetch('https://api.truto.one/link-token', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.TRUTO_API_TOKEN}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ tenant_id: workspaceId }),
  });
  if (!res.ok) throw new Error(`link-token failed: ${res.status}`);
  return res.json();
}
```

Your frontend passes that token to `authenticate()` from `@truto/truto-link-sdk`. The customer signs in to their CRM, and Truto sends `integrated_account:active` to your webhook. From then on, Truto keeps that account's token fresh.

The second part reads the contacts:

```typescript
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));

export async function listContacts(integratedAccountId: string) {
  const contacts: unknown[] = [];
  let cursor: string | null = null;
  let attempts = 0;

  while (true) {
    const url = new URL('https://api.truto.one/unified/crm/contacts');
    url.searchParams.set('integrated_account_id', integratedAccountId);
    if (cursor) url.searchParams.set('next_cursor', cursor);

    const res = await fetch(url, {
      headers: { Authorization: `Bearer ${process.env.TRUTO_API_TOKEN}` },
    });

    if (res.status === 429) {
      // Every CRM's limit comes back as a 429 with the same ratelimit-*
      // headers, and Retry-After when Truto has a value.
      if (++attempts > 5) throw new Error('Rate limited 5 times in a row');
      const wait = Number(res.headers.get('Retry-After')) || 10; // seconds; 10 if missing or a date
      await sleep(wait * 1000);
      continue; // retry the same page
    }
    if (!res.ok) throw new Error(`Truto returned ${res.status}`);
    attempts = 0;

    const page = await res.json();
    contacts.push(...page.result);
    cursor = page.next_cursor;
    if (!cursor) break;
  }

  return contacts;
}
```

Look at what the code does not have. It has no OAuth flow, no token table, no refresh job and no per-vendor paging. The same function reads HubSpot, Salesforce, Pipedrive or any other CRM in Truto's unified CRM API.

If you need a field that the unified model does not have, call the vendor's own endpoint through the Proxy API instead. The path changes to `https://api.truto.one/proxy/contacts`, and the response is the vendor's own record shape. Auth, refresh and paging stay the same.

### 4. When the app is not in the catalog

Ask Cursor to build it. The agent runs `truto integrations build <api-docs-url>`, reviews the integration file it writes, and runs `truto integrations apply <file>`. The integration is then live for every connected account, with no deploy of your app. The [Build page](https://truto.one/build/) shows each step, and the [Truto CLI](https://truto.one/cli/) page lists every command.

## How does a coding agent get a Truto account?

Today a person starts the account, and the agent does the rest:

1. Sign up free at [app.truto.one/signup](https://app.truto.one/signup). No card. The Free plan includes 25,000 API calls a month.
2. In the Truto dashboard, open **Settings**, select **API Tokens** and click **Create API Token**. Choose the environment you build in; each token sees one environment only. The [API token guide](https://truto.one/docs/guides/api-tokens/creating-api-tokens/) has every field.
3. Give the token to the agent. It runs `truto login --token <your-api-token>`, or reads `TRUTO_API_TOKEN` from the environment.
4. Install the Truto skills, as in [Give Cursor the Truto context](#1-give-cursor-the-truto-context).

After that, the agent can list integrations, connect a test account, make calls and build missing integrations from the terminal. Keep the token in your environment, not in the code.

> Keep building in Cursor. Let Truto run sign-in, token refresh and API changes for every customer.
>
> [Get a free sandbox](https://truto.one/sandbox/)
