# Change membership validity period

Modifies the validity period (duration) of a subscription (membership).
This changes how long the subscription remains active before expiring.
**Period units:**
- 1 = day
- 2 = week
- 3 = month
- 4 = year

**Use cases:**
- Extend expiration as customer service gesture
- Adjust period after policy changes
- Correct administrative errors

**Note:** Requires chain-level permissions.

Endpoint: POST /chain/{chain_id}/loyalty/abonements/{membership_id}/set_period
Version: 1.0.0
Security: BearerPartnerUser

## Security:

  - `BearerPartnerUser` (unknown)
    http bearer Bearer {PartnerToken}, User {UserToken}

## Path parameters:

  - `chain_id` (integer, required)
    Chain ID

  - `membership_id` (integer, required)
    Membership ID

## Header parameters:

  - `Accept` (string, required)

  - `Content-Type` (string, required)

  - `Authorization` (string, required)
    Bearer {partner_token}, User {user_token}

## Request fields (application/json):

  - `period` (integer, required)
    Duration value
    Example: 90

  - `period_unit_id` (integer, required)
    Period unit: 1 = day, 2 = week, 3 = month, 4 = year
    Enum: 1, 2, 3, 4

## Response 200:

  - `200` (unknown)
    Period updated successfully

## Response 200 fields (application/json):

  - `success` (boolean)
    Example: true

  - `data` (object)

  - `data.id` (integer)
    Example: 123

  - `data.period` (integer)
    Updated period duration
    Example: 90

  - `data.period_unit_id` (integer)
    Period unit type
    Example: 1

  - `data.expiration_date` (string)
    New expiration date
    Example: 2026-03-31T23:59:59+00:00

  - `meta` (array)
    Example: []

## Response 400:

  - `400` (unknown)
    Bad Request - cannot change period

## Response 400 fields (application/json):

  - `success` (boolean)
    Example: false

  - `data` (null)

  - `meta` (object)

  - `meta.message` (string)
    Example: Cannot change period

## Response 401:

  - `401` (unknown)
    Unauthorized

## Response 401 fields (application/json):

  - `success` (boolean)
    Example: false

  - `data` (null)

  - `meta` (object)

## Response 403:

  - `403` (unknown)
    Forbidden - insufficient permissions

## Response 403 fields (application/json):

  - `success` (boolean)
    Example: false

  - `data` (null)

  - `meta` (object)

## Response 404:

  - `404` (unknown)
    Subscription not found

## Response 404 fields (application/json):

  - `success` (boolean)
    Example: false

  - `data` (null)

  - `meta` (object)

## Response 422:

  - `422` (unknown)
    Validation error (invalid period values, etc.)

## Response 422 fields (application/json):

  - `success` (boolean)
    Example: false

  - `data` (null)

  - `meta` (object)

  - `meta.message` (string)
    Example: Invalid period unit

