Plans
Update a Plan
Update or archive a plan.
PUT
/
v1
/
plans
/
{id}
Update or archive a plan
curl --request PUT \
--url https://billing.example.com/v1/plans/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"hsn_code": "<string>",
"interval_count": 2,
"active": true
}
'import requests
url = "https://billing.example.com/v1/plans/{id}"
payload = {
"name": "<string>",
"hsn_code": "<string>",
"interval_count": 2,
"active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', hsn_code: '<string>', interval_count: 2, active: true})
};
fetch('https://billing.example.com/v1/plans/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://billing.example.com/v1/plans/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'hsn_code' => '<string>',
'interval_count' => 2,
'active' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://billing.example.com/v1/plans/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"hsn_code\": \"<string>\",\n \"interval_count\": 2,\n \"active\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://billing.example.com/v1/plans/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"hsn_code\": \"<string>\",\n \"interval_count\": 2,\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/plans/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"hsn_code\": \"<string>\",\n \"interval_count\": 2,\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"code": "<string>",
"interval_unit": "day",
"interval_count": 123,
"active": true,
"hsn_code": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"prices": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"currency": "<string>",
"amount": 123,
"type": "recurring",
"created_at": "2023-11-07T05:31:56Z"
}
]
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}Example request
curl -X PUT https://api.recurso.dev/v1/plans/3e7a9c52-1b4d-4f8e-a6c3-2d5b8e9f0a14 \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Pro (2026)"
}'
Errors
| Status | Code | When | Fix |
|---|---|---|---|
| 400 | validation_failed | id is not a valid UUID, or the request body is malformed JSON. | Pass the plan’s UUID and a valid JSON body. |
| 401 | unauthorized | API key missing or invalid (invalid_api_key), or a live/test mode mismatch (key_mode_mismatch). | Send Authorization: Bearer <api_key> with a key for the right mode. |
| 404 | not_found | No plan with that ID exists in your tenant. | Check the ID, and that the key belongs to the tenant that owns the plan. |
| 500 | internal_error | The update could not be persisted. | Retry; if it persists, contact support with the request timestamp. |
Authorizations
Tenant API key obtained from POST /auth/register or POST /v1/developer/keys.
Path Parameters
Body
application/json
Response
Updated plan.
Show child attributes
Show child attributes
⌘I
Update or archive a plan
curl --request PUT \
--url https://billing.example.com/v1/plans/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"hsn_code": "<string>",
"interval_count": 2,
"active": true
}
'import requests
url = "https://billing.example.com/v1/plans/{id}"
payload = {
"name": "<string>",
"hsn_code": "<string>",
"interval_count": 2,
"active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', hsn_code: '<string>', interval_count: 2, active: true})
};
fetch('https://billing.example.com/v1/plans/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://billing.example.com/v1/plans/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'hsn_code' => '<string>',
'interval_count' => 2,
'active' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://billing.example.com/v1/plans/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"hsn_code\": \"<string>\",\n \"interval_count\": 2,\n \"active\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://billing.example.com/v1/plans/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"hsn_code\": \"<string>\",\n \"interval_count\": 2,\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/plans/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"hsn_code\": \"<string>\",\n \"interval_count\": 2,\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"code": "<string>",
"interval_unit": "day",
"interval_count": 123,
"active": true,
"hsn_code": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"prices": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"currency": "<string>",
"amount": 123,
"type": "recurring",
"created_at": "2023-11-07T05:31:56Z"
}
]
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}