Skip to main content
PUT
/
v1
/
plans
/
{id}
Update Plan
curl --request PUT \
  --url https://api.example.com/v1/plans/{id} \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "lookup_key": "<string>",
  "description": "<string>",
  "display_order": 123,
  "metadata": {}
}
'
{
  "id": "<string>",
  "name": "<string>",
  "lookup_key": "<string>",
  "description": "<string>",
  "display_order": 123,
  "metadata": {},
  "environment_id": "<string>",
  "tenant_id": "<string>",
  "status": "<string>",
  "created_at": "<string>",
  "updated_at": "<string>",
  "created_by": "<string>",
  "updated_by": "<string>"
}

Path Parameters

id
string
required
Unique identifier of the plan to update.Example: "plan_a1b2c3d4e5f6g7h8i9j0"

Request Body

name
string
Updated human-readable name for the plan.Example: "Pro Plan - Updated"
lookup_key
string
Updated unique lookup key.Example: "pro-monthly-v2"
description
string
Updated description of the plan.Example: "Professional tier with enhanced features"
display_order
integer
Updated display order.Example: 3
metadata
object
Updated metadata. This replaces all existing metadata.Example: {"tier": "professional", "updated": "true"}

Response

id
string
Unique identifier for the plan.
name
string
Updated human-readable name for the plan.
lookup_key
string
Updated unique lookup key.
description
string
Updated description of the plan.
display_order
integer
Updated display order for the plan.
metadata
object
Updated custom metadata.
environment_id
string
Environment ID where the plan exists.
tenant_id
string
Tenant ID that owns this plan.
status
string
Status of the plan.
created_at
string
ISO 8601 timestamp when the plan was created.
updated_at
string
ISO 8601 timestamp when the plan was last updated.
created_by
string
ID of the user who created the plan.
updated_by
string
ID of the user who last updated the plan.

Example Request

cURL
curl --request PUT \
  --url https://api.flexprice.io/v1/plans/plan_a1b2c3d4e5f6g7h8i9j0 \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "Pro Plan - Enhanced",
    "description": "Professional tier with enhanced features and priority support",
    "metadata": {
      "tier": "professional",
      "updated": "true",
      "version": "2.0"
    }
  }'

Example Response

{
  "id": "plan_a1b2c3d4e5f6g7h8i9j0",
  "name": "Pro Plan - Enhanced",
  "lookup_key": "pro-monthly",
  "description": "Professional tier with enhanced features and priority support",
  "display_order": 2,
  "metadata": {
    "tier": "professional",
    "updated": "true",
    "version": "2.0"
  },
  "environment_id": "env_123",
  "tenant_id": "tenant_123",
  "status": "published",
  "created_at": "2024-03-20T15:04:05Z",
  "updated_at": "2024-03-20T16:45:22Z",
  "created_by": "user_456",
  "updated_by": "user_789"
}