curl --request PATCH \
--url https://anaconda.com/api/v1/organizations/{org_id}/users/{user_id}/token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expires_at": "2023-11-07T05:31:56Z",
"expiration_tolerance_months": 0,
"is_renewal": false
}
'import requests
url = "https://anaconda.com/api/v1/organizations/{org_id}/users/{user_id}/token"
payload = {
"expires_at": "2023-11-07T05:31:56Z",
"expiration_tolerance_months": 0,
"is_renewal": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
expires_at: '2023-11-07T05:31:56Z',
expiration_tolerance_months: 0,
is_renewal: false
})
};
fetch('https://anaconda.com/api/v1/organizations/{org_id}/users/{user_id}/token', 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://anaconda.com/api/v1/organizations/{org_id}/users/{user_id}/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'expires_at' => '2023-11-07T05:31:56Z',
'expiration_tolerance_months' => 0,
'is_renewal' => false
]),
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://anaconda.com/api/v1/organizations/{org_id}/users/{user_id}/token"
payload := strings.NewReader("{\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"expiration_tolerance_months\": 0,\n \"is_renewal\": false\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://anaconda.com/api/v1/organizations/{org_id}/users/{user_id}/token")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"expiration_tolerance_months\": 0,\n \"is_renewal\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://anaconda.com/api/v1/organizations/{org_id}/users/{user_id}/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"expiration_tolerance_months\": 0,\n \"is_renewal\": false\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Update User Token
Updates the expiration date of a user’s organization access token.
curl --request PATCH \
--url https://anaconda.com/api/v1/organizations/{org_id}/users/{user_id}/token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expires_at": "2023-11-07T05:31:56Z",
"expiration_tolerance_months": 0,
"is_renewal": false
}
'import requests
url = "https://anaconda.com/api/v1/organizations/{org_id}/users/{user_id}/token"
payload = {
"expires_at": "2023-11-07T05:31:56Z",
"expiration_tolerance_months": 0,
"is_renewal": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
expires_at: '2023-11-07T05:31:56Z',
expiration_tolerance_months: 0,
is_renewal: false
})
};
fetch('https://anaconda.com/api/v1/organizations/{org_id}/users/{user_id}/token', 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://anaconda.com/api/v1/organizations/{org_id}/users/{user_id}/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'expires_at' => '2023-11-07T05:31:56Z',
'expiration_tolerance_months' => 0,
'is_renewal' => false
]),
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://anaconda.com/api/v1/organizations/{org_id}/users/{user_id}/token"
payload := strings.NewReader("{\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"expiration_tolerance_months\": 0,\n \"is_renewal\": false\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://anaconda.com/api/v1/organizations/{org_id}/users/{user_id}/token")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"expiration_tolerance_months\": 0,\n \"is_renewal\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://anaconda.com/api/v1/organizations/{org_id}/users/{user_id}/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"expiration_tolerance_months\": 0,\n \"is_renewal\": false\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer token obtained by authenticating with service account credentials (client_id and client_secret).
See the Getting started page for the full authentication flow.
Path Parameters
Your organization ID, found in your organization's URL: anaconda.com/app/organizations/<ORG_ID>/.
The unique identifier of the user whose token to update.
Body
The new expiration date and time for the token in ISO 8601 format. Ignored when is_renewal is true.
Number of additional months to extend the token beyond the expires_at date as a grace period.
Set to true to automatically extend the token expiration to match your organization's subscription end date. When true, the expires_at field is ignored.
Response
Token updated successfully
Was this page helpful?