Crear un presupuesto
curl --request POST \
--url https://api.devin.ai/v3/enterprise/usage-policies/budgets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"copy_parent_grants": false,
"cycle_acu_limit": 4611686018427388000,
"parent_budget_id": "<string>"
}
'import requests
url = "https://api.devin.ai/v3/enterprise/usage-policies/budgets"
payload = {
"name": "<string>",
"copy_parent_grants": False,
"cycle_acu_limit": 4611686018427388000,
"parent_budget_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
copy_parent_grants: false,
cycle_acu_limit: 4611686018427388000,
parent_budget_id: '<string>'
})
};
fetch('https://api.devin.ai/v3/enterprise/usage-policies/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.devin.ai/v3/enterprise/usage-policies/budgets",
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>',
'copy_parent_grants' => false,
'cycle_acu_limit' => 4611686018427388000,
'parent_budget_id' => '<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://api.devin.ai/v3/enterprise/usage-policies/budgets"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"copy_parent_grants\": false,\n \"cycle_acu_limit\": 4611686018427388000,\n \"parent_budget_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.devin.ai/v3/enterprise/usage-policies/budgets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"copy_parent_grants\": false,\n \"cycle_acu_limit\": 4611686018427388000,\n \"parent_budget_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v3/enterprise/usage-policies/budgets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"copy_parent_grants\": false,\n \"cycle_acu_limit\": 4611686018427388000,\n \"parent_budget_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"budget_id": "<string>",
"cycle_acu_limit": 123,
"name": "<string>",
"org_ids": [
"<string>"
],
"parent_budget_id": "<string>",
"status": "active",
"temporary_cycle_acu_limit": 123
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}Presupuestos (Enterprise)
Crear un presupuesto
Crear un presupuesto dentro del presupuesto indicado por parent_budget_id.
La autorización funciona como en la API interna de presupuestos: requiere budget.configure y budget.share en el presupuesto superior. Si se omite parent_budget_id, se crea el presupuesto raíz; si la cuenta ya tiene uno, se devuelve un 409.
POST
/
v3
/
enterprise
/
usage-policies
/
budgets
Crear un presupuesto
curl --request POST \
--url https://api.devin.ai/v3/enterprise/usage-policies/budgets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"copy_parent_grants": false,
"cycle_acu_limit": 4611686018427388000,
"parent_budget_id": "<string>"
}
'import requests
url = "https://api.devin.ai/v3/enterprise/usage-policies/budgets"
payload = {
"name": "<string>",
"copy_parent_grants": False,
"cycle_acu_limit": 4611686018427388000,
"parent_budget_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
copy_parent_grants: false,
cycle_acu_limit: 4611686018427388000,
parent_budget_id: '<string>'
})
};
fetch('https://api.devin.ai/v3/enterprise/usage-policies/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.devin.ai/v3/enterprise/usage-policies/budgets",
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>',
'copy_parent_grants' => false,
'cycle_acu_limit' => 4611686018427388000,
'parent_budget_id' => '<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://api.devin.ai/v3/enterprise/usage-policies/budgets"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"copy_parent_grants\": false,\n \"cycle_acu_limit\": 4611686018427388000,\n \"parent_budget_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.devin.ai/v3/enterprise/usage-policies/budgets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"copy_parent_grants\": false,\n \"cycle_acu_limit\": 4611686018427388000,\n \"parent_budget_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v3/enterprise/usage-policies/budgets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"copy_parent_grants\": false,\n \"cycle_acu_limit\": 4611686018427388000,\n \"parent_budget_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"budget_id": "<string>",
"cycle_acu_limit": 123,
"name": "<string>",
"org_ids": [
"<string>"
],
"parent_budget_id": "<string>",
"status": "active",
"temporary_cycle_acu_limit": 123
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}Consulta Presupuestos para ver ejemplos y más detalles sobre los campos.
Permisos
Requiere un usuario de servicio o un token de acceso personal con el permisoManageAcuLimits a nivel empresarial, o bien acceso delegado al presupuesto.Cuerpo
application/json
Un nuevo presupuesto. Copia propia de la API del modelo interno BudgetCreateRequest,
de modo que los cambios internos en ese modelo no modifiquen el contrato publicado.
Respuesta
Respuesta satisfactoria
Un presupuesto cuyas políticas de uso se administran en /usage-policies/budgets/{budget_id}/...

