Create a business goal

Creates a business goal and links the conversion given in conversionId to it, with the goalType and goalValue target when they are given. Answers 201 with the goal. If the goal is created but the conversion cannot be linked, the goal is kept and the answer is 207 with the goal and a conversionError message. A name that already belongs to a goal or folder (a label in the API) is answered with 500 and an error message, not 409.

Body Params

A new business goal and the conversion to link to it, optionally with a target.

string
required

Name of the business goal. Must not be blank and must not match the name of an existing goal or folder (a label in the API).

string
required

Color of the goal's folder, as a hex code without the leading #.

string
required

What the goal is for. Required, but may be an empty string.

integer | null
required

Id of an existing conversion to link to the new goal. Required: a request without it, or with an id that matches no conversion, is a 422.

string | null

Date the goal should be reached by, such as 2026-12-31. Applied only when useTargetEndDate is 1. Must not be blank when given.

integer | null
enum

1 to give the goal a target end date, 0 or omitted for none. Sent as a number, not a boolean.

Allowed:
integer | null
enum

What the conversion target measures: 1 for the total number of conversions, 2 for total revenue. Used only with conversionId.

Allowed:
integer | null

The target the conversion should reach, for the goalType. Used only with conversionId.

Responses

422

A field is invalid: label or color is missing or blank, conversionId is missing or does not match a conversion, targetEndDate is blank, useTargetEndDate is not numeric, or goalType is not 1 or 2.

Language
Credentials
Header
URL
LoadingLoading…
Response
Choose an example:
application/json