Skip to content
The Public API is available on request. Email support@grona.ai to get access.

Set a campaign live or paused

PATCH
/v1/campaigns/{campaignId}/status
curl --request PATCH \
--url https://api.grona.ai/v1/campaigns/CMP-1024/status \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "status": "live" }'

live runs the campaign and paused stops it. Any other value returns 400.

Grona rebuilds your site script after the change. Visitors see the new state once the refreshed script reaches them, so the change is not instant in either direction.

campaignId
required
string
/^[A-Za-z0-9_.:-]{1,128}$/

Grona’s campaign id or your externalId. If a value matches both, Grona’s id wins.

Example

CMP-1024
Media typeapplication/json
object
status
required

live runs the campaign. paused stops it. New campaigns start paused.

string
Allowed values: live paused

Example

{
"status": "live"
}

The status after the change.

Media typeapplication/json
object
data
required
object
status
required

live runs the campaign. paused stops it. New campaigns start paused.

string
Allowed values: live paused
meta
required
object
workspaceId
required

The workspace resolved from the secret key.

string

Example

{
"data": {
"status": "live"
},
"meta": {
"workspaceId": "65e8a1c47d2f9b03e6a15c42"
}
}

The campaign id is not valid, or status is not live or paused. error.code is invalid_request. Nothing was changed.

Media typeapplication/json
object
error
required
object
code
required

Stable and machine-readable. Branch on this, and on the HTTP status for codes you do not know.

string
Allowed values: invalid_request unauthorized not_found conflict internal_error
message
required

Human-readable. The wording can change, so do not parse it.

string

Example

{
"error": {
"code": "invalid_request",
"message": "`status` must be `live` or `paused`."
}
}

The secret key is missing, malformed, unknown or revoked. error.code is unauthorized.

Media typeapplication/json
object
error
required
object
code
required

Stable and machine-readable. Branch on this, and on the HTTP status for codes you do not know.

string
Allowed values: invalid_request unauthorized not_found conflict internal_error
message
required

Human-readable. The wording can change, so do not parse it.

string

Example

{
"error": {
"code": "unauthorized",
"message": "Missing or invalid API key."
}
}

No campaign with this id or externalId exists in the key’s workspace. error.code is not_found.

Media typeapplication/json
object
error
required
object
code
required

Stable and machine-readable. Branch on this, and on the HTTP status for codes you do not know.

string
Allowed values: invalid_request unauthorized not_found conflict internal_error
message
required

Human-readable. The wording can change, so do not parse it.

string

Example

{
"error": {
"code": "not_found",
"message": "Campaign not found."
}
}

Too many requests. Retry with exponential backoff and jitter, and wait at least as long as Retry-After when it is present. Branch on the status code; the body is not guaranteed to use the error envelope.

Retry-After
string

How long to wait before retrying, in seconds or as an HTTP date.

Unexpected server error. error.code is internal_error. Retry with backoff; if it persists, contact support@grona.ai with the time of the request and the endpoint.

Media typeapplication/json
object
error
required
object
code
required

Stable and machine-readable. Branch on this, and on the HTTP status for codes you do not know.

string
Allowed values: invalid_request unauthorized not_found conflict internal_error
message
required

Human-readable. The wording can change, so do not parse it.

string

Example

{
"error": {
"code": "internal_error",
"message": "Something went wrong on our side."
}
}

Temporarily unavailable. Retry with exponential backoff and jitter, and wait at least as long as Retry-After when it is present. Branch on the status code; the body is not guaranteed to use the error envelope.

Retry-After
string

How long to wait before retrying, in seconds or as an HTTP date.