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

# Update an agent

> Change the brief, sources, or auto-approve setting of a Discovery Agent

Updates the brief, search sources, or `auto_approve` setting of a Discovery Agent. Send only the fields you want to change. At least one field is required. Requires the `write:discovery` permission.

> [!NOTE]
>
> `keywords` and `competitors` replace the saved list. Omit a list to keep it. An empty list removes all entries of that type, but the agent must keep at least one keyword or one competitor. Lookalikes do not count and are managed with [Update lookalikes](https://docs.affonso.io/api/endpoint/discovery/update-lookalikes.md).

## Path Parameters

**id** `string` *required*

Agent ID.

## Body Parameters

**name** `string`

Display name, 1 to 160 characters.

**website** `string`

Public product website. Must be a valid `http` or `https` URL that resolves to a public address.

**product\_brand** `string`

Product or brand the agent finds partners for, 1 to 200 characters.

**audience** `string`

One-sentence description of the customers the product serves, 1 to 500 characters.

**language** `string`

Search language as a two-letter ISO 639-1 code.

**channel** `string`

Only `websites` is accepted.

**exclude\_groups** `string[]`

Website categories to leave out of results. Up to 5 of `directories`, `marketplaces`, `social_networks`, `news`, `review_sites`. An empty list clears them.

**keywords** `string[]`

Replaces the saved keywords. Up to 25, each 1 to 200 characters.

**competitors** `string[]`

Replaces the saved competitor URLs. Up to 25 public `http` or `https` URLs.

**auto\_approve** `boolean`

When `true`, newly delivered prospects are approved automatically and queued for contact enrichment.

## Response

**success** `boolean`

`true` when the request succeeds.

**data** `object`

The updated Discovery Agent.

**Agent fields**

**id** `string`

Agent ID.

**name** `string`

Display name. Defaults to `Discovery agent` when no name was given on create.

**website** `string | null`

Product website from the agent brief.

**product\_brand** `string | null`

Product or brand the agent finds partners for.

**audience** `string | null`

One-sentence description of the customers the product serves.

**language** `string | null`

Search language as a lowercase ISO 639-1 code, for example `en`.

**channel** `string | null`

Where the agent searches. Currently always `websites`.

**exclude\_groups** `string[]`

Website categories the agent leaves out of results: `directories`, `marketplaces`, `social_networks`, `news`, `review_sites`.

**keywords** `string[]`

Topic sources the agent searches for.

**competitors** `string[]`

Competitor website URLs the agent uses as search sources.

**lookalikes** `string[]`

Lookalike page URLs. Managed with [Update lookalikes](https://docs.affonso.io/api/endpoint/discovery/update-lookalikes.md).

**sources** `array`

Every saved source, oldest first.

**Source fields**

**id** `string`

Source ID.

**type** `string`

`topic`, `competitor`, or `lookalike`.

**value** `string`

The keyword for a topic. The hostname without `www.` for a competitor. The URL for a lookalike.

**website** `string | null`

Full URL for competitor and lookalike sources. `null` for topics.

**created\_at** `string`

ISO 8601 timestamp.

**updated\_at** `string`

ISO 8601 timestamp.

**can\_start** `boolean`

`true` when the agent has at least one keyword or competitor. Lookalikes do not count.

**auto\_approve** `boolean`

When `true`, newly delivered prospects are approved automatically and queued for contact enrichment.

**schedulable** `boolean`

`false` while the agent is paused or deleted.

**paused\_at** `string | null`

ISO 8601 timestamp of the last pause. `null` while the agent is live.

**archived\_at** `string | null`

ISO 8601 timestamp of deletion. `null` unless the agent was deleted.

**latest\_run** `object | null`

Most recent search run, or `null` when the agent has no run yet.

**Latest run fields**

**id** `string`

Run ID.

**status** `string`

`pending`, `running`, `completed`, `empty`, or `failed`.

**started\_at** `string`

ISO 8601 timestamp.

**created\_at** `string`

ISO 8601 timestamp.

**updated\_at** `string`

ISO 8601 timestamp.

## Errors

* **400** `VALIDATION_ERROR`: the body fails validation or contains no field to update. The message is `Invalid request` and `details` lists the invalid fields.
* **400** `VALIDATION_ERROR`: the update would leave the agent without a keyword or competitor. The message is `A Discovery agent must keep at least one keyword or one competitor. Lookalikes do not count.`
* **400** `UNSAFE_URL`: a URL is not a public http or https address. This covers URLs with credentials, local or private hosts, hosts that do not resolve, and hosts that resolve to a non-public address.
* **404** `NOT_FOUND`: no agent with this ID exists for your team, or the agent was deleted. An agent that belongs to another team also returns `404`. The message is `Discovery agent not found`.
* **403** `INSUFFICIENT_PERMISSIONS`: the API key does not have the `write:discovery` permission.

```bash cURL Turn on auto-approve theme={null}
curl -X PATCH "https://api.affonso.io/v1/discovery/agents/cmn4agt0001xk92hf6d0abcd" \
  -H "Authorization: Bearer sk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "auto_approve": true
  }'
```

```bash cURL Replace keywords theme={null}
curl -X PATCH "https://api.affonso.io/v1/discovery/agents/cmn4agt0001xk92hf6d0abcd" \
  -H "Authorization: Bearer sk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "keywords": ["email marketing for small business", "newsletter tools"],
    "exclude_groups": []
  }'
```

```json Response theme={null}
{
  "success": true,
  "data": {
    "id": "cmn4agt0001xk92hf6d0abcd",
    "name": "Newsletter partners",
    "website": "https://example.com",
    "product_brand": "Example Mail, email marketing for small shops",
    "audience": "Owners of small online shops who send a weekly newsletter.",
    "language": "en",
    "channel": "websites",
    "exclude_groups": ["directories", "marketplaces"],
    "keywords": ["email marketing for small business"],
    "competitors": ["https://example.org"],
    "lookalikes": [],
    "sources": [
      {
        "id": "cmn4src0001xk92hf6d0abcd",
        "type": "topic",
        "value": "email marketing for small business",
        "website": null,
        "created_at": "2026-11-02T09:00:00.000Z",
        "updated_at": "2026-11-02T09:00:00.000Z"
      },
      {
        "id": "cmn4src0002xk92hf6d0abcd",
        "type": "competitor",
        "value": "example.org",
        "website": "https://example.org",
        "created_at": "2026-11-02T09:00:00.000Z",
        "updated_at": "2026-11-02T09:00:00.000Z"
      }
    ],
    "can_start": true,
    "auto_approve": true,
    "schedulable": true,
    "paused_at": null,
    "archived_at": null,
    "latest_run": {
      "id": "cmn4run0001xk92hf6d0abcd",
      "status": "completed",
      "started_at": "2026-11-03T06:00:00.000Z"
    },
    "created_at": "2026-11-02T09:00:00.000Z",
    "updated_at": "2026-11-05T14:20:00.000Z"
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.