---
title: "Record a goal completion"
method: POST
path: "/goals"
tags: ["Events"]
---

# Record a goal completion

`POST /goals`

## Request

- Base URL: `https://analytics.flowsery.com/analytics/api/v1`
- URL: `https://analytics.flowsery.com/analytics/api/v1/goals`
- Auth: HTTP bearer

Records a conversion from your own backend. Attach it to a known visitor with `visitorUid`, or omit it to record an anonymous completion.

## Headers

- `X-Workspace-Id` string

## Request body

- TrackGoalRequest
  - `name` string, required: Lowercase letters, digits, underscores and hyphens only.
  - `metadata` object: Arbitrary string key/value pairs stored with the completion.
  - `websiteId` string
  - `domain` string
  - `visitorUid` string: Ties the completion to a known visitor. Omit for anonymous events.
  - `sessionUid` string
  - `timezone` string

## Response `200`

Goal recorded

- MessageResponse
  - `status` 'success', required
  - `data` object[], required
    - `message` string

## Other responses

- `400`: Validation error
- `401`: Missing, invalid, expired or revoked API key or access token. `code: token_issuer_lost_access` means the member who created the API key was deactivated or lost access to the workspace: ask a workspace admin for a new key
- `403`: The credentials are valid but cannot be used here. `code: permission_denied`: the workspace role behind the API key or OAuth sign-in lacks `flowsery.write`; `role`, `keyRole` and `issuerRole` say which role fell short. `code: subscription_required`: the organization plan does not include API access. `code: workspace_access_denied`: `X-Workspace-Id` names a workspace the caller cannot reach, or an API key was sent to a workspace other than its own
- `404`: Website not found
- `429`: Rate limit exceeded

---

[API](https://skmtc.dev/flowsery/apis/flowsery-analytics-public-api.md) · [All operations](https://skmtc.dev/flowsery/apis/flowsery-analytics-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/flowsery/apis/flowsery-analytics-public-api/revisions/8f23583fdf0e?raw)
