Skip to main content
PUT
/
orgs
/
{org_id}
/
billing
/
budgets
cURL
curl --request PUT \
  --url https://api.timbal.ai/orgs/{org_id}/billing/budgets \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "budgets": [
    {
      "budget_type": "<string>",
      "limit_credits": "<string>",
      "created_at": "2023-11-07T05:31:56Z",
      "current_credits": 123,
      "id": "<string>",
      "period_end": "2023-11-07T05:31:56Z",
      "period_start": "2023-11-07T05:31:56Z",
      "project_id": "<string>",
      "project_name": "<string>",
      "role_id": "<string>",
      "role_name": "<string>",
      "updated_at": "2023-11-07T05:31:56Z"
    }
  ]
}
'
import requests

url = "https://api.timbal.ai/orgs/{org_id}/billing/budgets"

payload = { "budgets": [
{
"budget_type": "<string>",
"limit_credits": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"current_credits": 123,
"id": "<string>",
"period_end": "2023-11-07T05:31:56Z",
"period_start": "2023-11-07T05:31:56Z",
"project_id": "<string>",
"project_name": "<string>",
"role_id": "<string>",
"role_name": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
budgets: [
{
budget_type: '<string>',
limit_credits: '<string>',
created_at: '2023-11-07T05:31:56Z',
current_credits: 123,
id: '<string>',
period_end: '2023-11-07T05:31:56Z',
period_start: '2023-11-07T05:31:56Z',
project_id: '<string>',
project_name: '<string>',
role_id: '<string>',
role_name: '<string>',
updated_at: '2023-11-07T05:31:56Z'
}
]
})
};

fetch('https://api.timbal.ai/orgs/{org_id}/billing/budgets', 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.timbal.ai/orgs/{org_id}/billing/budgets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'budgets' => [
[
'budget_type' => '<string>',
'limit_credits' => '<string>',
'created_at' => '2023-11-07T05:31:56Z',
'current_credits' => 123,
'id' => '<string>',
'period_end' => '2023-11-07T05:31:56Z',
'period_start' => '2023-11-07T05:31:56Z',
'project_id' => '<string>',
'project_name' => '<string>',
'role_id' => '<string>',
'role_name' => '<string>',
'updated_at' => '2023-11-07T05:31:56Z'
]
]
]),
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://api.timbal.ai/orgs/{org_id}/billing/budgets"

payload := strings.NewReader("{\n \"budgets\": [\n {\n \"budget_type\": \"<string>\",\n \"limit_credits\": \"<string>\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"current_credits\": 123,\n \"id\": \"<string>\",\n \"period_end\": \"2023-11-07T05:31:56Z\",\n \"period_start\": \"2023-11-07T05:31:56Z\",\n \"project_id\": \"<string>\",\n \"project_name\": \"<string>\",\n \"role_id\": \"<string>\",\n \"role_name\": \"<string>\",\n \"updated_at\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}")

req, _ := http.NewRequest("PUT", 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.put("https://api.timbal.ai/orgs/{org_id}/billing/budgets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"budgets\": [\n {\n \"budget_type\": \"<string>\",\n \"limit_credits\": \"<string>\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"current_credits\": 123,\n \"id\": \"<string>\",\n \"period_end\": \"2023-11-07T05:31:56Z\",\n \"period_start\": \"2023-11-07T05:31:56Z\",\n \"project_id\": \"<string>\",\n \"project_name\": \"<string>\",\n \"role_id\": \"<string>\",\n \"role_name\": \"<string>\",\n \"updated_at\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.timbal.ai/orgs/{org_id}/billing/budgets")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"budgets\": [\n {\n \"budget_type\": \"<string>\",\n \"limit_credits\": \"<string>\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"current_credits\": 123,\n \"id\": \"<string>\",\n \"period_end\": \"2023-11-07T05:31:56Z\",\n \"period_start\": \"2023-11-07T05:31:56Z\",\n \"project_id\": \"<string>\",\n \"project_name\": \"<string>\",\n \"role_id\": \"<string>\",\n \"role_name\": \"<string>\",\n \"updated_at\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "budgets": [
    {
      "budget_type": "<string>",
      "limit_credits": "<string>",
      "created_at": "2023-11-07T05:31:56Z",
      "current_credits": 123,
      "id": "<string>",
      "period_end": "2023-11-07T05:31:56Z",
      "period_start": "2023-11-07T05:31:56Z",
      "project_id": "<string>",
      "project_name": "<string>",
      "role_id": "<string>",
      "role_name": "<string>",
      "updated_at": "2023-11-07T05:31:56Z"
    }
  ]
}

Authorizations

Authorization
string
header
required

Timbal API key. Obtain your API key from the Timbal platform settings. See Authentication for more information.

Path Parameters

org_id
string
required

Body

application/json
budgets
object[]
required

Response

Budgets saved

budgets
object[]
required