Update savings plan subscription
To update a savings plan subscription, perform the following request:
PATCH
/v1/savings/account-investment-plans/{account_investment_plan_id}Request
Headers
| Field | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Access token in Bearer ACCESS_TOKEN format |
Content-Type | string | Yes | Must be application/json |
Path Parameters
| Field | Type | Required | Description |
|---|---|---|---|
account_investment_plan_id | number | Yes | Subscription identifier. |
Not applicable: Query Parameters.
Body
The body must be sent in snake_case.
| Field | Type | Required | Description |
|---|---|---|---|
target_amount | number | No | New target amount for the plan. |
subscription_name | string | No | New subscription name. |
Response
2XX Success
| Field | Type | Description |
|---|---|---|
message | string | Message confirming the result of the operation. |
Error Codes
Errors return the following body:
{
"code": "invalid_request",
"description": "Error description."
}
| Status | Code | Condition |
|---|---|---|
400 | subscription_not_found | The specified subscription does not exist. |
403 | — | The token does not have the required role to operate this endpoint. |
Code Example
- cURL
- JavaScript
- Python
- Node.js
curl -X PATCH https://b2b.allaria.dev/v1/savings/account-investment-plans/1 \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"target_amount": 300000.00,
"subscription_name": "Updated savings plan"
}'
const accountInvestmentPlanId = 1;
const response = await fetch(
`https://b2b.allaria.dev/v1/savings/account-investment-plans/${accountInvestmentPlanId}`,
{
method: 'PATCH',
headers: {
'Authorization': 'Bearer ACCESS_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
target_amount: 300000.00,
subscription_name: 'Updated savings plan'
})
}
);
const data = await response.json();
console.log(data);
import requests
account_investment_plan_id = 1
response = requests.patch(
f'https://b2b.allaria.dev/v1/savings/account-investment-plans/{account_investment_plan_id}',
headers={
'Authorization': 'Bearer ACCESS_TOKEN',
'Content-Type': 'application/json'
},
json={
'target_amount': 300000.00,
'subscription_name': 'Updated savings plan'
}
)
data = response.json()
print(data)
const axios = require('axios');
const accountInvestmentPlanId = 1;
const response = await axios.patch(
`https://b2b.allaria.dev/v1/savings/account-investment-plans/${accountInvestmentPlanId}`,
{
target_amount: 300000.00,
subscription_name: 'Updated savings plan'
},
{
headers: {
Authorization: 'Bearer ACCESS_TOKEN',
'Content-Type': 'application/json'
}
}
);
console.log(response.data);
2XX Success
{
"message": "Subscription updated successfully"
}