Cancel a coaching period

DELETE/api/public/escorts/{escortId}

Cancel a coaching period. The trainee keeps their history.

Authentication

Requires an API key, sent as Authorization: Bearer cp_live_....

API keys carry scopes. Get the catalog of scopes and webhook events lists every scope.

Path parameters

Path parameters
NameTypeDescription
escortIdrequiredstring

Header parameters

Header parameters
NameTypeDescription
Idempotency-Keystring

Optional. Send a unique key (e.g. a UUID) to make this POST safe to retry. The same key within 24h returns the original result instead of creating a duplicate.

Request body

application/json, required

Request body fields
NameTypeDescription
cancelReasonstring

Request examples

cURL
curl --request DELETE \
  --url 'https://api.coach-platform.com/api/public/escorts/<escortId>' \
  --header 'Authorization: Bearer cp_live_...' \
  --header 'Content-Type: application/json' \
  --data '{
  "cancelReason": "<string>"
}'
JavaScript (fetch)
const response = await fetch('https://api.coach-platform.com/api/public/escorts/<escortId>', {
  method: 'DELETE',
  headers: {
    Authorization: 'Bearer cp_live_...',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "cancelReason": "<string>"
  }),
});

const data = await response.json();

Responses

200 OK

Successful response

Example body (application/json)
{
  "data": {
    "id": "<string>",
    "coach": "<string>",
    "trainee": {
      "id": "<string>",
      "name": "<string>",
      "email": "<string>",
      "phoneNumber": "<string>"
    },
    "status": "pending",
    "escortType": "<string>",
    "startDate": "<date-time>",
    "endDate": "<date-time>",
    "months": 123,
    "isUnlimited": true,
    "training": {
      "activeTrainingPlan": {
        "id": "<string>",
        "title": "<string>",
        "level": "<string>"
      },
      "trainingDays": null
    },
    "nutrition": {
      "activeNutritionPlan": {
        "id": "<string>",
        "title": "<string>",
        "level": "<string>"
      }
    },
    "skipRegistrationForms": true,
    "createdAt": "<date-time>"
  }
}
Response fields (27)
Response fields
NameTypeDescription
dataobject
data.idstring
data.coachstring
data.traineeobject

The escorted trainee. email and phoneNumber are returned only when the key also has the trainees:read scope.

data.trainee.idstring
data.trainee.namestring
data.trainee.emailstring
data.trainee.phoneNumberstring
data.statusstring

Allowed values: pending active canceled completed suspended

data.escortTypestring
data.startDatestring<date-time>
data.endDatestring<date-time> | null

When the coaching period ends. null when the escort runs with no time limit, in which case isUnlimited is true.

data.monthsinteger | null

Duration in months. null when the escort runs with no time limit.

data.isUnlimitedboolean

True when the escort has no end date.

data.trainingobject
data.training.activeTrainingPlanobject | null
data.training.activeTrainingPlan.idstring
data.training.activeTrainingPlan.titlestring
data.training.activeTrainingPlan.levelstring
data.training.trainingDaysany
data.nutritionobject
data.nutrition.activeNutritionPlanobject | null
data.nutrition.activeNutritionPlan.idstring
data.nutrition.activeNutritionPlan.titlestring
data.nutrition.activeNutritionPlan.levelstring
data.skipRegistrationFormsboolean

true when the trainee is not asked to fill registration forms in the app during this coaching period. Change it with PATCH /escorts/{escortId}.

data.createdAtstring<date-time>

Error responses

  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 409 Conflict
  • 429 Too Many Requests
  • 500 Internal Server Error

These statuses share the same response body.

Example body (application/json)
{
  "error": {
    "code": "<string>",
    "message": "<string>",
    "fix": "<string>",
    "details": {},
    "retryAfterMs": 123
  }
}
Error fields (6)
Error fields
NameTypeDescription
errorobject
error.codestring
error.messagestring
error.fixstring | null
error.detailsobject | null
error.retryAfterMsnumber | null

This page is also available as Markdown. Browse it in the interactive explorer or download the OpenAPI spec.