# Update a plan `PATCH / PUT / POST /api/v1/plans/{id}` Updates a plan by ID. ## Permissions Send your API key in `X-API-Key`. Required permissions are **Plans → Write**. ## Headers - `X-Sport-Id` (integer, required) — The sport ID from [List sports](/api/sports/list.md). Use the sport the record belongs to. ## Path parameters - `id` (integer, required) — ID of the plan. ## Body parameters - `name` (string) — Plan name, up to 100 characters. Must be unique for the dates and sport. - `amount` (integer) — Plan amount in minor currency units. - `currency` (string) — Three-letter currency code, stored in uppercase. - `plan_start` (integer or date string) — Start of the plan, as Unix seconds or an ISO date. - `plan_end` (integer or date string) — End of the plan, as Unix seconds or an ISO date. - `is_membership_fee` (integer) — Use 1 to mark the plan as a membership fee. Omission on update resets the value to 0. - `exclude` (integer) — Use 1 to exclude the plan from plan selection. Omission on update resets the value to 0. - `exclude_from_renewals` (integer) — Use 1 to exclude this plan from renewals. - `metadata` (map or null) — Plan metadata. The optional payments_expected schedule contains entries with date and a positive amount in minor currency units. - `use_season_dates` (boolean) — Use September 1 and August 31 of the current sports season for the plan dates. - `update_linked_subscriptions_dates` (boolean) — Apply changed plan dates to linked subscriptions. Defaults to false. - `create_linked_subscriptions_expected_payments` (boolean) — Create expected payments from the configured schedule for eligible linked subscriptions. Defaults to false. Include the current `is_membership_fee` and `exclude` values if you want to preserve them. Use [Preview expected payment eligibility](/api/plans/preview-payments.md) before generating payments for linked subscriptions. ## Request (PATCH) Set ASDINCLOUD_API_KEY and any variables named in the example before running it. ```sh curl --request PATCH \ --url "https://api.asdincloud.com/api/v1/plans/${ID:?Set ID}" \ --header "X-API-Key: $ASDINCLOUD_API_KEY" \ --header "X-Sport-Id: ${SPORT_ID:?Set SPORT_ID}" \ --header "Content-Type: application/json" \ --data '{"name":"Junior season registration","is_membership_fee":0,"exclude":0}' ``` ## Request (PUT) Set ASDINCLOUD_API_KEY and any variables named in the example before running it. ```sh curl --request PUT \ --url "https://api.asdincloud.com/api/v1/plans/${ID:?Set ID}" \ --header "X-API-Key: $ASDINCLOUD_API_KEY" \ --header "X-Sport-Id: ${SPORT_ID:?Set SPORT_ID}" \ --header "Content-Type: application/json" \ --data '{"name":"Junior season registration","is_membership_fee":0,"exclude":0}' ``` ## Request (POST) Set ASDINCLOUD_API_KEY and any variables named in the example before running it. ```sh curl --request POST \ --url "https://api.asdincloud.com/api/v1/plans/${ID:?Set ID}" \ --header "X-API-Key: $ASDINCLOUD_API_KEY" \ --header "X-Sport-Id: ${SPORT_ID:?Set SPORT_ID}" \ --header "Content-Type: application/json" \ --data '{"name":"Junior season registration","is_membership_fee":0,"exclude":0}' ``` ## Response **200 OK** Returns a successful update response. Example with fictional data and selected fields. ```json { "message_key": "entities.plan.messages.updated", "data": { "id": 13, "updated_subscriptions_count": 0, "created_payments_subscriptions_count": 0, "created_payments_count": 0, "skipped_subscriptions_count": 0 } } ``` ## Errors - `401` — The API key is missing or invalid. - `403` — The API key lacks the required permission. - `404` — The requested record was not found. - `400` — The schedule contains invalid dates or amounts. - `422` — The fields failed validation or the name is already in use for the same dates. - `500` — The update could not be saved.