---
title: "Record user consent"
method: POST
path: "/api/v1/consent"
tags: ["Consent"]
---

# Record user consent

`POST /api/v1/consent`

## Request

- Base URL: `https://policyforge.co`
- URL: `https://policyforge.co/api/v1/consent`
- Auth: HTTP bearer

Record a website visitor's consent preferences. Use this to track which cookie/data categories a visitor has accepted or rejected. The consent record is stored and can be retrieved later for compliance audits.

## Request body

- ConsentCreateRequest
  - `user_id` string, required: Your website visitor's unique identifier
  - `policy_version` string, required: Version of the privacy policy the consent applies to
  - `consents` object, required: Map of consent categories to accepted/rejected status
  - `ip_address` string: Visitor's IP address (for audit trail)
  - `user_agent` string: Visitor's browser user agent (for audit trail)
  - `policy_id` string, uuid: Optional. UUID of a PolicyForge policy this consent ties to. Must be a policy owned by the same account as the API key, or the request returns 404. Setting this lets the consent show up under the policy's analytics card and be filterable via `GET /api/v1/consent?policy_id=...`.

## Response `200`

Consent recorded

- ConsentResponse
  - `id` string
  - `user_id` string
  - `policy_version` string
  - `policy_id` string, uuid, nullable: Echoes the policy_id from the request, or null if none was provided.
  - `consents` object
  - `recorded_at` string, date-time
  - `status` string

## Other responses

- `400`: Missing required fields
- `401`: Missing or invalid API key
- `429`: Rate limit exceeded

---

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