Créer un budget
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"
}Budgets (Entreprise)
Créer un budget
Créer un budget sous le budget indiqué par parent_budget_id.
Les autorisations sont les mêmes que pour l’API interne des budgets : budget.configure et budget.share sont requis sur le parent. Si parent_budget_id est omis, le budget racine est créé, ce qui renvoie une erreur 409 si le compte en possède déjà un.
POST
/
v3
/
enterprise
/
usage-policies
/
budgets
Créer un budget
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"
}Consultez Budgets pour le détail des champs et des exemples.
Autorisations
Nécessite un utilisateur de service ou un jeton d’accès personnel disposant de l’autorisationManageAcuLimits au niveau Enterprise, ou d’un accès délégué au budget.Corps
application/json
Un nouveau budget. Copie propre à l’API du modèle interne BudgetCreateRequest,
afin que les modifications internes de ce modèle n’affectent pas le contrat publié.
Réponse
Réponse réussie
Un budget dont les politiques d’utilisation sont gérées sous /usage-policies/budgets/{budget_id}/...

