---
title: "Propose how AI spend should be attributed, for the human to confirm in the dashboard"
method: POST
path: "/api/connect/plan"
tags: ["connect"]
---

# Propose how AI spend should be attributed, for the human to confirm in the dashboard

`POST /api/connect/plan`

## Request

- Base URL: `https://www.spendline.ai`
- URL: `https://www.spendline.ai/api/connect/plan`
- Auth: API key in header `x-spendline-key`

Sent by a coding agent after analysing the repository INSIDE the human's development environment.
Carries identifier NAMES only (e.g. "workspace.id", "process.env.NODE_ENV"), never source code:
a source with a newline, brace or more than 120 characters is refused.

A mapping the agent cannot determine confidently is sent with confidence "unknown", no source,
and a one-line business-language question. Never invent a mapping.

Replaces the account's previous plan. The Connect page updates live. Poll GET until status is
"confirmed" before changing any code. See /agents/connect.md.

## Request body

- object
  - `agent_tool` 'cursor' | 'claude-code' | 'other'
  - `repository_label` string: A project name to show the human. Not a path.
  - `providers` string[]
  - `sdks` string[]
  - `call_sites` integer
  - `mappings` object, required: Keys: customer, agent, team (required); workflow, environment (optional).

## Response `201`

Stored and shown to the human. Poll GET /api/connect/plan.

## Other responses

- `400`: invalid_plan or unsupported_provider, with the exact field to fix. Each confident mapping needs kind: expression (evaluated per request) or literal (a fixed value); the server refuses a source that does not match it.

---

[API](https://skmtc.dev/spendline/apis/spendline-api.md) · [All operations](https://skmtc.dev/spendline/apis/spendline-api/llms.txt) · [OpenAPI document](https://skmtc.dev/spendline/apis/spendline-api/revisions/eb22b9415a28?raw)
