curl --request POST \
--url https://api.edenai.run/v2/user/custom_token/ \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"balance": "<string>",
"expire_time": "2023-11-07T05:31:56Z",
"active_balance": true,
"balance_reset_amount": "<string>"
}
'import requests
url = "https://api.edenai.run/v2/user/custom_token/"
payload = {
"name": "<string>",
"balance": "<string>",
"expire_time": "2023-11-07T05:31:56Z",
"active_balance": True,
"balance_reset_amount": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
balance: '<string>',
expire_time: '2023-11-07T05:31:56Z',
active_balance: true,
balance_reset_amount: '<string>'
})
};
fetch('https://api.edenai.run/v2/user/custom_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://api.edenai.run/v2/user/custom_token/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'balance' => '<string>',
'expire_time' => '2023-11-07T05:31:56Z',
'active_balance' => true,
'balance_reset_amount' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://api.edenai.run/v2/user/custom_token/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"balance\": \"<string>\",\n \"expire_time\": \"2023-11-07T05:31:56Z\",\n \"active_balance\": true,\n \"balance_reset_amount\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.edenai.run/v2/user/custom_token/")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"balance\": \"<string>\",\n \"expire_time\": \"2023-11-07T05:31:56Z\",\n \"active_balance\": true,\n \"balance_reset_amount\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.edenai.run/v2/user/custom_token/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"balance\": \"<string>\",\n \"expire_time\": \"2023-11-07T05:31:56Z\",\n \"active_balance\": true,\n \"balance_reset_amount\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"token_type": "sandbox_api_token",
"balance": "<string>",
"expire_time": "2023-11-07T05:31:56Z",
"active_balance": true,
"balance_reset_amount": "<string>",
"balance_reset_period": "none"
}Create new Token
curl --request POST \
--url https://api.edenai.run/v2/user/custom_token/ \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"balance": "<string>",
"expire_time": "2023-11-07T05:31:56Z",
"active_balance": true,
"balance_reset_amount": "<string>"
}
'import requests
url = "https://api.edenai.run/v2/user/custom_token/"
payload = {
"name": "<string>",
"balance": "<string>",
"expire_time": "2023-11-07T05:31:56Z",
"active_balance": True,
"balance_reset_amount": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
balance: '<string>',
expire_time: '2023-11-07T05:31:56Z',
active_balance: true,
balance_reset_amount: '<string>'
})
};
fetch('https://api.edenai.run/v2/user/custom_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://api.edenai.run/v2/user/custom_token/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'balance' => '<string>',
'expire_time' => '2023-11-07T05:31:56Z',
'active_balance' => true,
'balance_reset_amount' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://api.edenai.run/v2/user/custom_token/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"balance\": \"<string>\",\n \"expire_time\": \"2023-11-07T05:31:56Z\",\n \"active_balance\": true,\n \"balance_reset_amount\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.edenai.run/v2/user/custom_token/")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"balance\": \"<string>\",\n \"expire_time\": \"2023-11-07T05:31:56Z\",\n \"active_balance\": true,\n \"balance_reset_amount\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.edenai.run/v2/user/custom_token/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"balance\": \"<string>\",\n \"expire_time\": \"2023-11-07T05:31:56Z\",\n \"active_balance\": true,\n \"balance_reset_amount\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"token_type": "sandbox_api_token",
"balance": "<string>",
"expire_time": "2023-11-07T05:31:56Z",
"active_balance": true,
"balance_reset_amount": "<string>",
"balance_reset_period": "none"
}Body
The token name
1 - 200sandbox_api_token- Sandboxapi_token- Back
sandbox_api_token, api_token Optional remaining credits balance for this Token, if active_balance is set to True and the balance reaches 0, this token will become unusable
^-?\d{0,5}(?:\.\d{0,9})?$Weither to use the balance field or not.
The amount this token's balance is reset to at the start of each balance_reset_period. Null when balance_reset_period is 'none'.
^-?\d{0,5}(?:\.\d{0,9})?$How often this token's balance is reinitialized to balance_reset_amount. 'none' = one-time balance (default, current behaviour).
none- Nonedaily- Dailyweekly- Weeklymonthly- Monthly
none, daily, weekly, monthly Response
The token name
200sandbox_api_token- Sandboxapi_token- Back
sandbox_api_token, api_token Optional remaining credits balance for this Token, if active_balance is set to True and the balance reaches 0, this token will become unusable
^-?\d{0,5}(?:\.\d{0,9})?$Weither to use the balance field or not.
The amount this token's balance is reset to at the start of each balance_reset_period. Null when balance_reset_period is 'none'.
^-?\d{0,5}(?:\.\d{0,9})?$How often this token's balance is reinitialized to balance_reset_amount. 'none' = one-time balance (default, current behaviour).
none- Nonedaily- Dailyweekly- Weeklymonthly- Monthly
none, daily, weekly, monthly