Skip to main content
PATCH
/
accounts
/
{account_id}
/
features
/
{feature_id}
/
entries
/
{entry_id}
Update a feature credits entry
curl --request PATCH \
  --url https://api.togai.com/accounts/{account_id}/features/{feature_id}/entries/{entry_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "effectiveUntil": "2023-02-23T14:25:10Z",
  "granted": 200
}'
{
  "id": "purchase.20rvWRxQcQK.0ZwPG$1",
  "status": "ACTIVE",
  "source": "ENTITLEMENT",
  "effectiveFrom": "2020-01-01T00:00:00Z",
  "effectiveUntil": "2025-01-01T00:00:00Z",
  "granted": 15,
  "balance": 10,
  "used": 5
}
Initial:
{
  "id": "<entry_id>",
  "source": PURCHASE",
  "accountId": "acc.fdjsl.313",
  "featureId": "feat.fdjsl.313",
  "granted": 100,
  "balance": 20
}
Action: Update granted units to 120 unitsPOST /accounts/acc.fdjsl.313/features/feat.fdjsl.313/entries/<entry_id>
{
  "grantedUnits": 120
}
OutputAdjustment units = new granted units - previous granted units (120100=20)(120 - 100 = 20)New balance = current balance + adjustment units (20+20=40)(20 + 20 = 40)
Initial:
{
  "id": "<entry_id>",
  "source": PURCHASE",
  "accountId": "acc.fdjsl.313",
  "featureId": "feat.fdjsl.313",
  "granted": 100,
  "balance": 20
}
Action: Update granted units to 70 unitsPOST /accounts/acc.fdjsl.313/features/feat.fdjsl.313/entries/<entry_id>
{
  "granted": 70
}
OutputAdjustment units = new granted units - previous granted units (70100=30)(70 - 100 = -30)New balance = current balance + adjustment units (20+(30)=10)(20 + (-30) = -10) -> 400 Bad Request

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

account_id
string
required

account_id corresponding to an account

Maximum length: 50
Example:

"ACC00001"

feature_id
string
required

feature_id corresponding to a feature

Maximum length: 50
Example:

"feat.fdjskl.sdkjl"

entry_id
string
required

entryId corresponding to a particular entitlement/overage grant entry

Formats:

  1. If source of entry is an entitlement grant rate card in price plan: schedule_id#pricing_cycle_start_date$PRICE_PLAN
  2. If source of entry is an entitlement overage rate card in price plan: schedule_id#pricing_cycle_start_date$OVERAGE
  3. If source of entry is a purchase: purchase_id#int_index$PURCHASE
Maximum length: 50
Example:

"purchase.21HbazIT3JQ.D90jC#1$PURCHASE"

Body

application/json
effectiveUntil
string<date-time>

Expiry date-time for a feature credits entry

granted
number

Granted units for a feature credits entry

Response

Success response

Get feature credits response

id
string
required
Maximum length: 50
Example:

"purchase.20rvWRxQcQK.0ZwPG$1"

source
enum<string>
required

Source of the feature credit

Available options:
ENTITLEMENT,
PRICE_PLAN,
OVERAGE,
REFUND
status
enum<string>
required

Status of the feature credit entry

Available options:
ACTIVE,
EXPIRED,
VOIDED
effectiveFrom
string<date-time>
required
Example:

"2021-03-04T14:25:10Z"

effectiveUntil
string<date-time>
required
Example:

"2021-05-20T01:00:10Z"

used
number
required
Example:

10

granted
number
Example:

15

balance
number
Example:

10

I