---
title: "Create or update a contact (upsert)"
method: PUT
path: "/contacts/{externalContactId}"
tags: ["contacts"]
---

# Create or update a contact (upsert)

`PUT /contacts/{externalContactId}`

## Request

- Base URL: `https://api.mailly.site` (the document declares no server; this is the origin it was published from)
- URL: `https://api.mailly.site/contacts/{externalContactId}`
- Auth: HTTP bearer

## Path parameters

- `externalContactId` string, required: Stable key of the external contact

## Request body

- object: Contact fields
  - `email` string
  - `externalId` string
  - `name` string
  - `attributes` object
  - `tags` string[]

## Response `200`

Updated

- object
  - `success` boolean, required
  - `created` boolean, required
  - `contact` object, required

## Other responses

- `201`: Created
- `400`: Invalid parameters
- `401`: Missing or invalid API key
- `404`: Contact not found
- `409`: Conflict

---

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