REST API - Levels Route

The levels route allows you to interact with the Restrict Content Pro membership levels database to retrieve levels, add new ones, update existing levels, and delete levels.

Get levels

GET /wp-json/rcp/{version}/levels/

Required parameters:

  • None.

Optional parameters:

  • status (string) - Retrieve only membership levels with the specified status
    • all, active, inactive
  • limit (int) - The maximum number of levels to retrieve
  • orderby (string) - What column to order the results by
    • list_order, id, name, price

Get specific level

GET /wp-json/rcp/{version}/levels/{level_id}

Required parameters:

  • id - The level ID to retrieve. Can be passed in the URL or as part of the body.

Optional parameters:

  • None.

New level

POST /wp-json/rcp/{version}/levels/new

Required parameters:

  • name (string) - The name of the membership level.

Optional parameters:

  • description (string) - The level description.
  • duration (int) - The length of the membership.
  • duration_unit (string) - The duration unit.
    • day, month, year
  • trial_duration (int) - The length of the free trial. Omit for no trial.
  • trial_duration_unit (string) - The trial duration unit.
    • day, month, year
  • price (float) - The price of the membership (no currency symbol).
  • fee (int) - The extra fee to apply at signup.
  • list_order (int) - List order.
  • status (int) - The status of the membership level.
    • inactive, active
  • role (string) - The user role to assign to members of this level.

Update level

POST /wp-json/rcp/{version}/levels/update/{level_id}

Required parameters:

  • id (int) - The ID of the membership level to update. Can be passed in the URL or as part of the body.

Optional parameters:

  • name (string) - The name of the membership level.
  • description (string) - The level description.
  • duration (int) - The length of the membership.
  • duration_unit (string) - The duration unit.
    • day, month, year
  • trial_duration (int) - The length of the free trial. Omit for no trial.
  • trial_duration_unit (string) - The trial duration unit.
    • day, month, year
  • price (float) - The price of the membership (no currency symbol).
  • fee (int) - The extra fee to apply at signup.
  • list_order (int) - List order.
  • status (int) - The status of the membership level.
    • inactive, active
  • role (string) - The user role to assign to members of this level.

Delete level

DELETE /wp-json/rcp/{version}/levels/delete

Required parameters:

  • id (int) - The ID of the membership level to delete

Optional parameters:

  • None.
Have more questions? Submit a request