---
title: "Upsert End User"
method: PUT
path: "/api/v1/end-users/{external_id}"
tags: ["end-users"]
---

# Upsert End User

`PUT /api/v1/end-users/{external_id}`

## Request

- Base URL: `https://api.maritime.sh` (the document declares no server; this is the origin it was published from)
- URL: `https://api.maritime.sh/api/v1/end-users/{external_id}`
- Auth: HTTP bearer

Creates the end user, or updates the fields sent. 201 on create, 200 after.

## Path parameters

- `external_id` string, required

## Request body

- EndUserUpsert: Body of ``PUT /api/v1/end-users/{external_id}``. Absent fields are kept.
  - `displayName` string, nullable
  - `metadata` object, nullable
  - `tags` string[], nullable

## Response `200`

Successful Response

- EndUserResponse: One end user with its rollups.
  - `id` string, required
  - `externalId` string, required
  - `displayName` string, nullable
  - `metadata` object
  - `tags` string[]
  - `status` string, required
  - `policy` object, nullable
  - `agentCount` integer
  - `agents` EndUserAgentSummary[]
    - `id` string, required
    - `name` string, required
    - `status` string, required
    - `framework` string, nullable
    - `templateId` string, nullable
    - `projectId` string, nullable
    - `projectRole` string, nullable
    - `baseAgent` BaseAgentRef: The product an end user's agent was stamped from: the base agent of its project.
      - `id` string, required
      - `name` string, required
    - `createdAt` string, date-time, required
    - `lastActiveAt` string, date-time, nullable
  - `aiSpendCents30d` number
  - `messageCount` integer
  - `lastMessage` EndUserLastMessage: The last thing said between the end user and their agent.
    - `at` string, date-time, required
    - `fromAgent` boolean, required
    - `text` string, nullable
    - `imageCount` integer
    - `failed` boolean
  - `activity14d` integer[]
  - `createdAt` string, date-time, required
  - `updatedAt` string, date-time, required
  - `lastActiveAt` string, date-time, nullable

## Other responses

- `422`: Validation Error

---

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