curl --request PATCH \
--url https://cloud-api.near.ai/v1/admin/organizations/{org_id}/limits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"spendLimit": {
"amount": 123,
"currency": "<string>"
},
"changeReason": "<string>",
"changedBy": "<string>",
"source": "<string>"
}
'import requests
url = "https://cloud-api.near.ai/v1/admin/organizations/{org_id}/limits"
payload = {
"spendLimit": {
"amount": 123,
"currency": "<string>"
},
"changeReason": "<string>",
"changedBy": "<string>",
"source": "<string>"
}
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({
spendLimit: {amount: 123, currency: '<string>'},
changeReason: '<string>',
changedBy: '<string>',
source: '<string>'
})
};
fetch('https://cloud-api.near.ai/v1/admin/organizations/{org_id}/limits', 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://cloud-api.near.ai/v1/admin/organizations/{org_id}/limits",
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([
'spendLimit' => [
'amount' => 123,
'currency' => '<string>'
],
'changeReason' => '<string>',
'changedBy' => '<string>',
'source' => '<string>'
]),
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://cloud-api.near.ai/v1/admin/organizations/{org_id}/limits"
payload := strings.NewReader("{\n \"spendLimit\": {\n \"amount\": 123,\n \"currency\": \"<string>\"\n },\n \"changeReason\": \"<string>\",\n \"changedBy\": \"<string>\",\n \"source\": \"<string>\"\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://cloud-api.near.ai/v1/admin/organizations/{org_id}/limits")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"spendLimit\": {\n \"amount\": 123,\n \"currency\": \"<string>\"\n },\n \"changeReason\": \"<string>\",\n \"changedBy\": \"<string>\",\n \"source\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.near.ai/v1/admin/organizations/{org_id}/limits")
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 \"spendLimit\": {\n \"amount\": 123,\n \"currency\": \"<string>\"\n },\n \"changeReason\": \"<string>\",\n \"changedBy\": \"<string>\",\n \"source\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"organization_id": "<string>",
"spendLimit": {
"amount": 123,
"currency": "<string>",
"scale": 123
},
"type": "grant",
"updated_at": "<string>",
"source": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Update organization limits (Admin only)
Updates spending limits for a specific organization. This endpoint is typically called by a billing service with an admin API key when a customer makes a purchase.
curl --request PATCH \
--url https://cloud-api.near.ai/v1/admin/organizations/{org_id}/limits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"spendLimit": {
"amount": 123,
"currency": "<string>"
},
"changeReason": "<string>",
"changedBy": "<string>",
"source": "<string>"
}
'import requests
url = "https://cloud-api.near.ai/v1/admin/organizations/{org_id}/limits"
payload = {
"spendLimit": {
"amount": 123,
"currency": "<string>"
},
"changeReason": "<string>",
"changedBy": "<string>",
"source": "<string>"
}
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({
spendLimit: {amount: 123, currency: '<string>'},
changeReason: '<string>',
changedBy: '<string>',
source: '<string>'
})
};
fetch('https://cloud-api.near.ai/v1/admin/organizations/{org_id}/limits', 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://cloud-api.near.ai/v1/admin/organizations/{org_id}/limits",
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([
'spendLimit' => [
'amount' => 123,
'currency' => '<string>'
],
'changeReason' => '<string>',
'changedBy' => '<string>',
'source' => '<string>'
]),
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://cloud-api.near.ai/v1/admin/organizations/{org_id}/limits"
payload := strings.NewReader("{\n \"spendLimit\": {\n \"amount\": 123,\n \"currency\": \"<string>\"\n },\n \"changeReason\": \"<string>\",\n \"changedBy\": \"<string>\",\n \"source\": \"<string>\"\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://cloud-api.near.ai/v1/admin/organizations/{org_id}/limits")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"spendLimit\": {\n \"amount\": 123,\n \"currency\": \"<string>\"\n },\n \"changeReason\": \"<string>\",\n \"changedBy\": \"<string>\",\n \"source\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.near.ai/v1/admin/organizations/{org_id}/limits")
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 \"spendLimit\": {\n \"amount\": 123,\n \"currency\": \"<string>\"\n },\n \"changeReason\": \"<string>\",\n \"changedBy\": \"<string>\",\n \"source\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"organization_id": "<string>",
"spendLimit": {
"amount": 123,
"currency": "<string>",
"scale": 123
},
"type": "grant",
"updated_at": "<string>",
"source": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Authorizations
JWT access token for user authentication (Authorization: Bearer <jwt_token>). Create via POST /users/me/access_tokens.
Path Parameters
Organization ID to update limits for
Body
Request to update organization limits (Admin only)
Spend limit for API requests
The system internally uses a fixed scale of 9 (nano-dollars = 1 billionth of a dollar). Clients must provide amounts in nano-dollars.
Examples: $100.00 USD: amount=100000000000, currency="USD" $1.00 USD: amount=1000000000, currency="USD" $0.01 USD: amount=10000000, currency="USD"
Show child attributes
Show child attributes
Credit type for organization limits
- grant: Free credits provided by the platform
- payment: Credits purchased by the organization
- staking_farm: House of Stake farm reward units converted into credits
grant, payment, staking_farm Response
Organization limits updated successfully
Response after updating organization limits
Spend limit for API responses
The system uses a fixed scale of 9 (nano-dollars = 1 billionth of a dollar). The scale field is included in responses for client convenience.
Examples: $100.00 USD: amount=100000000000, scale=9, currency="USD" $0.01 USD: amount=10000000, scale=9, currency="USD"
Show child attributes
Show child attributes
Credit type for organization limits
- grant: Free credits provided by the platform
- payment: Credits purchased by the organization
- staking_farm: House of Stake farm reward units converted into credits
grant, payment, staking_farm