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

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Upsert contact

> Create or update a Brevo contact by email address.

`upsertContact` creates a contact or updates the record with the same email. It
can set attributes, add list memberships, and change marketing blocklists.

## Example

```ts theme={null}
import { automation, onHttpRequest } from "automate.ax"
import { upsertContact } from "automate.ax/brevo"

export default automation("Upsert a customer", () => {
  onHttpRequest({ scope: "automation" })

  upsertContact({
    email: "ada@example.com",
    extId: "customer_123",
    attributes: { firstname: "Ada", score: 10 },
    lists: ["Customers"],
  })
})
```

## Inputs

`email` is required. `attributes` values may be string, number, boolean, or
string array; Automate.ax uppercases attribute names before sending them.
Optional `extId`, list names or positive IDs, `emailBlacklisted`,
`smsBlacklisted`, `smtpBlacklistSender`, and `forceMerge` are supported.
`forceMerge` defaults to `false`; `account` selects the Brevo binding.

## Output

Returns `{ id: number }` for the created or updated contact. Attribute
definitions must already exist in the Brevo account and values must match their
configured types. List names are resolved case-insensitively by exact name;
missing or ambiguous names fail before the contact write.
