> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloud.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Build Your First Agent

> This guide assumes you have a parent account set up and a JWT signing key configured. It takes you from zero to a working agent querying a customer's live data source in three steps.

For initial account setup, see the [Quick Start Guide](/en/Quick-Start-Embedded). For a diagram of how the components fit together, see [Reference Architecture](/en/Architecture-Embedded).

## Step 1: Create a Sub-Account for Your Customer

Each of your customers receives an isolated sub-account. Create one using the Account API:

```bash wrap theme={null}
POST https://cloud.cdata.com/api/poweredby/account/create
Authorization: Bearer <your-signed-JWT>
{
  "accountName": "acme-corp",
  "externalId": "your-internal-customer-id"
}
```

The response includes the `accountId` you use in subsequent calls for this customer. See the [Create Account](/en/API/Account-API) reference for full request and response details.

## Step 2: Create a Connection and Redirect Your Customer to Authenticate

Create a connection for the sub-account. Connect AI Embed returns a redirect URL that sends your customer to a hosted connection page where they authenticate using their own credentials.

```bash wrap theme={null}
POST https://cloud.cdata.com/api/poweredby/connection/create
Authorization: Bearer <your-signed-JWT-with-sub-account-id>
{
  "sourceType": "Salesforce"
}
```

The response includes a `redirectURL`. Send your customer to that URL. CData handles the authentication UI and credential lifecycle. When the customer completes authentication, Connect AI Embed redirects them back to your application with the `connectionId`.
See the [Create Connection](/en/API/Connection-API) in the API Reference and [Connection Flow](/en/Connection-Flow) for full details.

## Step 3: Point Your Agent at the MCP Endpoint and Start Querying

With a sub-account and connection in place, your agent can query live data through MCP. Generate a JWT scoped to the customer's connection and point your MCP client at the endpoint:

```bash wrap theme={null}
# JWT must include:
# iss: your parent account ID
# sub: the sub-account ID for this customer
# connection_ids: ["<connectionId from Step 2>"]

# Agent discovers available sources
getCatalogs()
# Response: ["Salesforce"]

# Agent queries live data
queryData("SELECT Id, Name, Amount FROM Opportunity WHERE IsClosed = 0")
```

The standard MCP tools are consistent across hundreds of sources. The same Get Schemas → Get Tables → Get Columns → Query Data pattern works whether your customer has connected Salesforce, Jira, NetSuite, or any other supported source.

See [MCP](/en/API/MCP-Embedded) in the API Reference for the full tools reference, including how to use getInstructions to get source-specific query guidance before writing your first query.
