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

Delete a campaign

DELETE
/v1/campaigns/{campaignId}
curl --request DELETE \
--url https://api.grona.ai/v1/campaigns/CMP-1024 \
--header 'Authorization: Bearer <token>'

Deletes the campaign and the variations created with it. Deletion is permanent and frees the campaign’s externalId for reuse. data.id is always Grona’s id, even when you call it with your externalId.

If you retry a delete, address the campaign by Grona’s id, never by externalId. Once the first attempt frees the externalId, a retry could delete a new campaign that took it.

Grona then removes the campaign from your site script. Visitors can still see it until the refreshed script reaches them, so the change is not instant.

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

Deleted.

Media typeapplication/json
object
data
required
object
id
required

Grona’s id of the deleted campaign.

string
deletedVariationIds
required

The variations deleted with the campaign.

Array<string>
meta
required
object
workspaceId
required

The workspace resolved from the secret key.

string

Example

{
"data": {
"id": "671a3c90e4b0a1f2c3d40011",
"deletedVariationIds": [
"671a3c90e4b0a1f2c3d40012"
]
},
"meta": {
"workspaceId": "65e8a1c47d2f9b03e6a15c42"
}
}

The request is invalid. error.code is invalid_request and error.message says what to change. Nothing in the request was applied.

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": "The campaign id is not a valid id."
}
}

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.