---
title: "Create-or-update a subject (shallow-merges profile/consent)"
method: PUT
path: "/api/subjects/{subjectId}"
tags: ["Subjects"]
---

# Create-or-update a subject (shallow-merges profile/consent)

`PUT /api/subjects/{subjectId}`

## Request

- Base URL: `http://localhost:38200`
- URL: `http://localhost:38200/api/subjects/{subjectId}`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `token`

## Path parameters

- `subjectId` string, required

## Request body

- object
  - `profile` object
  - `consent` object
  - `piiFlags` object

## Response `200`

The upserted subject.

- Subject
  - `subjectId` string
  - `tenantId` integer
  - `profile` object
  - `consent` object
  - `createdAt` string, date-time
  - `updatedAt` string, date-time

## Other responses

- `400`: Request body/query failed Zod validation.
- `401`: Missing or invalid credentials.

---

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