Update OAuth Token
This request updates an OAuth token, targeted by secure ID.
patch | /oauth/tokens/{token_sid} |
put | /oauth/tokens/{token_sid} |
Sample
A sample PATCH request to update an OAuth Token object, targeted by secure ID, with the values in the request body:
curl -X PATCH \
'https://api.carrierx.com/core/v2/oauth/tokens/b3f45e4d-7d46-467b-9724-272f57ac420e' \
-H 'Content-Type: application/json' \
--data-binary '{"name":"new_test_token"}' \
-H 'Authorization: Bearer 5ebc03d6-8b2b-44ad-bf65-72d4f1491dda'
Response
200
status code with a serialized copy of the updated OAuth Token object:
{
"access_token": "8bfd6c6d-6291-488a-bed1-8784c195ce87",
"client_id": "5c7965f285344165b003ce1a3202e589",
"date_created": "2024-09-11T13:46:42.211Z",
"date_expiration_access_token": "2124-08-18T13:46:42.169Z",
"date_expiration_refresh_token": "2124-08-18T13:46:42.169Z",
"date_last_accessed": null,
"ip_last_accessed": null,
"name": "new_test_token",
"partner_sid": "cee93bf3-5746-43fe-a1a2-822c05fef687",
"refresh_token": "ed07dcd6-dfc5-4d7b-b7b4-891441371b3e",
"scopes": [
"accesscontrol.manage",
"endpoints.manage",
"oauth.manage",
"partners.manage",
"phonenumber.manage",
"push.manage",
"shortener.manage",
"sms.manage",
"storage.manage",
"trunk_groups.manage",
"trunk_groups.trunks.manage"
],
"token_sid": "b3f45e4d-7d46-467b-9724-272f57ac420e",
"token_type": "bearer"
}
An OAuth Token object can be updated using either a PATCH
or PUT
request.
-
A
PATCH
request can be used to update one or more attribute values. When using aPATCH
request, only the attributes specified in the request payload will be updated, all other attributes and values will remain the same. The OAuth token secure ID is passed in the query URL, and the values to be modified are passed in the request body. -
A
PUT
request can be used to update an entire OAuth Token object. The OAuth token secure ID is passed in the query URL, and the entire OAuth Token object is passed in the request body.
Note, while all the fields must be present in a PUT
request, not all the attribute values may be modified after the initial creation, because when created, some of them become read-only.
Required Scopes
To update an OAuth Token object, the partner must have one of the following scopes enabled:
oauth.manage_all_tokens
oauth.manage
oauth.update
To update an OAuth Token object scope
parameter, the partner must additionally have the oauth.allow_token_scope_update
scope enabled.
Path Arguments
Parameter | Data Type | Description |
---|---|---|
token_sid required | string | The OAuth token secure ID. |
Body Arguments
JSON representation of the fields and values to be updated.
Fields that can be modified are:
date_expiration_access_token
date_expiration_refresh_token
name
scopes
Refer to this table to view all fields that appear in the OAuth Token object.