Change status

Pause a promotion, resume it, turn on a draft, or end it for good.

The photos change in the background: retrieve the promotion afterwards to confirm its new status.

POSThttps://api.spyne.ai/api/pv1/promotions/{id}/status
AuthBearer tokenRate limit30 changes / min per rooftop

Before you call it

Which action works depends on the promotion's current status:

Current statusactivatepausecomplete
draftYes. Scheduled instead if its start date is aheadNoNo
scheduledNo: it goes live by itself on its start dateNoNo
activeNoYesYes
pausedYes (resumes it)NoYes
completedNoNoNo

A promotion with no vehicles or no images can't be activated. A draft or scheduled promotion can't be completed; delete it instead. Anything not allowed returns 409 INVALID_STATUS_CHANGE, and message says why.

Counts toward the 30 changes a minute per rooftop.


Path parameters

Requiredalways send
ParameterTypeRequiredDescription
idintegerRequiredThe promotion id.

Request body

ParameterTypeRequiredDescription
actionstringRequiredactivate (turn on, or resume a paused one), pause (stop for now) or complete (end for good; can't be undone).

Sample request

curl --request POST \
  --url 'https://api.spyne.ai/api/pv1/promotions/351/status' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{ "action": "pause" }'
import requests

url = "https://api.spyne.ai/api/pv1/promotions/351/status"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
}

response = requests.post(url, headers=headers, json={"action": "pause"})
print(response.status_code, response.json())
const response = await fetch("https://api.spyne.ai/api/pv1/promotions/351/status", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ action: "pause" }),
});
console.log(response.status, await response.json());

Sample response

{
  "success": true,
  "statusCode": 202,
  "message": "Promotion pause in progress",
  "data": {
    "id": "351",
    "action": "pause",
    "status": "paused"
  }
}

Response parameters (202)

ParameterTypeDescription
data.idstringThe promotion id, as sent in the path.
data.actionstringThe action you sent.
data.statusstringThe new status: active, scheduled (a draft with a future start), paused or completed.

Errors

StatusCodeWhen it happens
400INVALID_REQUESTaction is missing or isn't activate, pause or complete.
404PROMOTION_NOT_FOUNDNo such promotion for this rooftop.
409INVALID_STATUS_CHANGEThe action isn't allowed in the current status (see the table above).
400VALIDATION_FAILEDSpyne refused the change.
400TEAM_NOT_RESOLVEDThe API key isn't linked to a rooftop.
401UNAUTHORIZEDThe API key is missing or wrong.
429RATE_LIMITEDMore than 30 changes this minute. Wait the seconds in Retry-After.
502 / 503SERVICE_UNAVAILABLEA Spyne service is briefly unavailable. Retry shortly.

What happens next

Retrieve the promotion to confirm the new status. A completed promotion can be deleted when you no longer need it.


Did this page help you?