# Agent API reference

The six supported campaign actions, exact request examples, response semantics and the public schema.

Source: https://linkdevi.com/docs/api
Updated: 2026-11-27

## Endpoint and schema

```http
POST https://linkdevi.com/api/v1/agent
```

Send JSON with an action discriminator and the fields for that action. Bearer authentication is required, including for the API preview. Bodies are limited to 16 KiB. The OpenAPI document is generated from the implementation schemas; it covers the agent endpoint and recorded-conversion REST endpoints, not every legacy LinkDevi API operation.

- [OpenAPI 3.1 JSON](https://linkdevi.com/api/v1/openapi)
- [Legacy link API help](https://linkdevi.com/help/api)

## Inspect capabilities

```bash
curl --fail-with-body --request POST 'https://linkdevi.com/api/v1/agent' \
  --header "Authorization: Bearer $LINKDEVI_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "action": "capabilities"
}'
```

Returns workspaceId, scopes, plan, limits, usage.storedLinks, tools and counterDefinition. limits.links reflects the effective stored-link allowance, including workspace overrides. This is a snapshot; concurrent work may consume remaining slots.

## Preview a campaign

```json
{
  "action": "preview_campaign",
  "campaign": {
    "requestId": "a43c37c0-350a-44ef-9d40-a5900c246891",
    "name": "Product launch",
    "url": "https://example.com/launch",
    "utmCampaign": "product-launch",
    "domain": "linkdevi.com",
    "channels": [
      "facebook",
      "line",
      "print"
    ]
  }
}
```

Send this body to the same authenticated endpoint. Returns requestId, linksToCreate, channels[].channel, channels[].destinationUrl and createsResources: false. Generate your own UUID for each real intent and persist it before creation. Preview is not quota reservation.

## Create the reviewed intent

```json
{
  "action": "create_campaign",
  "campaign": {
    "requestId": "a43c37c0-350a-44ef-9d40-a5900c246891",
    "name": "Product launch",
    "url": "https://example.com/launch",
    "utmCampaign": "product-launch",
    "domain": "linkdevi.com",
    "channels": [
      "facebook",
      "line",
      "print"
    ]
  }
}
```

201 means a new campaign was created. 200 with reused: true means an identical replay. The response includes campaign, reused, managePath and counterDefinition. Saved link URLs are at campaign.channels[].link.shortUrl. The name, UTM and channels come from your intent; code-generated sample IDs are illustrative, not existing resources.

A campaign request contains requestId (UUID), name and utmCampaign (1–100 characters), url (up to 2,048 characters including generated destinations), domain (supported public system domain), and 1–8 distinct supported channels. Unknown fields are rejected.

## List campaigns and read counters

```json
{
  "action": "list_campaigns",
  "page": 1
}
```

Returns items, total, page and pageSize: 20. Page numbers start at 1.

```json
{
  "action": "campaign_stats",
  "campaignId": "SAVED_CAMPAIGN_ID"
}
```

Replace SAVED_CAMPAIGN_ID with an ID from creation or listing. Returns campaign, observedAt, unavailableChannels, managePath and counterDefinition. observedAt is the read time, not a completeness watermark or a reporting date range.

## Render a saved link's QR

```json
{
  "action": "link_qr",
  "linkId": "SAVED_LINK_ID",
  "size": 300
}
```

Replace SAVED_LINK_ID with a link ID from your campaign. size is an integer from 100 to 512. Returns linkId, shortUrl, qrDataUrl and persistsResource: false. Uses the saved short domain; creates neither a new link nor a stored QR record.

## Recorded conversions are a separate REST capability

GET /api/v1/conversions requires analytics:read and returns source-labelled recorded events. POST /api/conv requires a separate conversions:write credential on your server. Prefer a signed receipt with a stable event_id and preserve both on retry. Exact destination-origin opt-in is required. These are reported events, not payment verification; do not combine namespaces or sum currencies. The six-tool MCP connector does not expose these REST operations.

- [Conversion setup and limits](https://linkdevi.com/help/conversions)
