package main
import(
"context"
"github.com/conductorone/conductorone-sdk-go/pkg/models/shared"
conductoronesdkgo "github.com/conductorone/conductorone-sdk-go"
"log"
)
func main() {
ctx := context.Background()
s := conductoronesdkgo.New(
conductoronesdkgo.WithSecurity(shared.Security{
BearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
Oauth: "<YOUR_OAUTH_HERE>",
}),
)
res, err := s.SpendInsights.GetAttributionRollups(ctx, nil)
if err != nil {
log.Fatal(err)
}
if res.GetAttributionRollupsResponse != nil {
// handle response
}
}curl --request POST \
--url https://{tenantDomain}.conductor.one/api/v1/spend-insights/attribution/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"endTime": "2023-11-07T05:31:56Z",
"filters": {
"appIds": [
"<string>"
],
"departmentAbsent": true,
"departments": [
"<string>"
],
"modelIds": [
"<string>"
],
"userIds": [
"<string>"
]
},
"pageSize": 123,
"pageToken": "<string>",
"startTime": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://{tenantDomain}.conductor.one/api/v1/spend-insights/attribution/search"
payload = {
"endTime": "2023-11-07T05:31:56Z",
"filters": {
"appIds": ["<string>"],
"departmentAbsent": True,
"departments": ["<string>"],
"modelIds": ["<string>"],
"userIds": ["<string>"]
},
"pageSize": 123,
"pageToken": "<string>",
"startTime": "2023-11-07T05:31:56Z"
}
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({
endTime: '2023-11-07T05:31:56Z',
filters: {
appIds: ['<string>'],
departmentAbsent: true,
departments: ['<string>'],
modelIds: ['<string>'],
userIds: ['<string>']
},
pageSize: 123,
pageToken: '<string>',
startTime: '2023-11-07T05:31:56Z'
})
};
fetch('https://{tenantDomain}.conductor.one/api/v1/spend-insights/attribution/search', 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://{tenantDomain}.conductor.one/api/v1/spend-insights/attribution/search",
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([
'endTime' => '2023-11-07T05:31:56Z',
'filters' => [
'appIds' => [
'<string>'
],
'departmentAbsent' => true,
'departments' => [
'<string>'
],
'modelIds' => [
'<string>'
],
'userIds' => [
'<string>'
]
],
'pageSize' => 123,
'pageToken' => '<string>',
'startTime' => '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;
}HttpResponse<String> response = Unirest.post("https://{tenantDomain}.conductor.one/api/v1/spend-insights/attribution/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"endTime\": \"2023-11-07T05:31:56Z\",\n \"filters\": {\n \"appIds\": [\n \"<string>\"\n ],\n \"departmentAbsent\": true,\n \"departments\": [\n \"<string>\"\n ],\n \"modelIds\": [\n \"<string>\"\n ],\n \"userIds\": [\n \"<string>\"\n ]\n },\n \"pageSize\": 123,\n \"pageToken\": \"<string>\",\n \"startTime\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenantDomain}.conductor.one/api/v1/spend-insights/attribution/search")
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 \"endTime\": \"2023-11-07T05:31:56Z\",\n \"filters\": {\n \"appIds\": [\n \"<string>\"\n ],\n \"departmentAbsent\": true,\n \"departments\": [\n \"<string>\"\n ],\n \"modelIds\": [\n \"<string>\"\n ],\n \"userIds\": [\n \"<string>\"\n ]\n },\n \"pageSize\": 123,\n \"pageToken\": \"<string>\",\n \"startTime\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"groups": [
{
"billableTokens": "<string>",
"blendedCostPerMillionTokensNano": "<string>",
"cacheReadTokens": "<string>",
"cacheReadValueNano": "<string>",
"cacheWriteCostNano": "<string>",
"cacheWriteTokens": "<string>",
"displayName": "<string>",
"inputTokens": "<string>",
"key": "<string>",
"missing": true,
"outputTokens": "<string>",
"reasoningTokens": "<string>",
"settledCalls": "<string>",
"settledNano": "<string>"
}
],
"nextPageToken": "<string>"
}Get Attribution Rollups
Get ranked settled-spend attribution groups for one dimension and time window.
package main
import(
"context"
"github.com/conductorone/conductorone-sdk-go/pkg/models/shared"
conductoronesdkgo "github.com/conductorone/conductorone-sdk-go"
"log"
)
func main() {
ctx := context.Background()
s := conductoronesdkgo.New(
conductoronesdkgo.WithSecurity(shared.Security{
BearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
Oauth: "<YOUR_OAUTH_HERE>",
}),
)
res, err := s.SpendInsights.GetAttributionRollups(ctx, nil)
if err != nil {
log.Fatal(err)
}
if res.GetAttributionRollupsResponse != nil {
// handle response
}
}curl --request POST \
--url https://{tenantDomain}.conductor.one/api/v1/spend-insights/attribution/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"endTime": "2023-11-07T05:31:56Z",
"filters": {
"appIds": [
"<string>"
],
"departmentAbsent": true,
"departments": [
"<string>"
],
"modelIds": [
"<string>"
],
"userIds": [
"<string>"
]
},
"pageSize": 123,
"pageToken": "<string>",
"startTime": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://{tenantDomain}.conductor.one/api/v1/spend-insights/attribution/search"
payload = {
"endTime": "2023-11-07T05:31:56Z",
"filters": {
"appIds": ["<string>"],
"departmentAbsent": True,
"departments": ["<string>"],
"modelIds": ["<string>"],
"userIds": ["<string>"]
},
"pageSize": 123,
"pageToken": "<string>",
"startTime": "2023-11-07T05:31:56Z"
}
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({
endTime: '2023-11-07T05:31:56Z',
filters: {
appIds: ['<string>'],
departmentAbsent: true,
departments: ['<string>'],
modelIds: ['<string>'],
userIds: ['<string>']
},
pageSize: 123,
pageToken: '<string>',
startTime: '2023-11-07T05:31:56Z'
})
};
fetch('https://{tenantDomain}.conductor.one/api/v1/spend-insights/attribution/search', 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://{tenantDomain}.conductor.one/api/v1/spend-insights/attribution/search",
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([
'endTime' => '2023-11-07T05:31:56Z',
'filters' => [
'appIds' => [
'<string>'
],
'departmentAbsent' => true,
'departments' => [
'<string>'
],
'modelIds' => [
'<string>'
],
'userIds' => [
'<string>'
]
],
'pageSize' => 123,
'pageToken' => '<string>',
'startTime' => '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;
}HttpResponse<String> response = Unirest.post("https://{tenantDomain}.conductor.one/api/v1/spend-insights/attribution/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"endTime\": \"2023-11-07T05:31:56Z\",\n \"filters\": {\n \"appIds\": [\n \"<string>\"\n ],\n \"departmentAbsent\": true,\n \"departments\": [\n \"<string>\"\n ],\n \"modelIds\": [\n \"<string>\"\n ],\n \"userIds\": [\n \"<string>\"\n ]\n },\n \"pageSize\": 123,\n \"pageToken\": \"<string>\",\n \"startTime\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenantDomain}.conductor.one/api/v1/spend-insights/attribution/search")
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 \"endTime\": \"2023-11-07T05:31:56Z\",\n \"filters\": {\n \"appIds\": [\n \"<string>\"\n ],\n \"departmentAbsent\": true,\n \"departments\": [\n \"<string>\"\n ],\n \"modelIds\": [\n \"<string>\"\n ],\n \"userIds\": [\n \"<string>\"\n ]\n },\n \"pageSize\": 123,\n \"pageToken\": \"<string>\",\n \"startTime\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"groups": [
{
"billableTokens": "<string>",
"blendedCostPerMillionTokensNano": "<string>",
"cacheReadTokens": "<string>",
"cacheReadValueNano": "<string>",
"cacheWriteCostNano": "<string>",
"cacheWriteTokens": "<string>",
"displayName": "<string>",
"inputTokens": "<string>",
"key": "<string>",
"missing": true,
"outputTokens": "<string>",
"reasoningTokens": "<string>",
"settledCalls": "<string>",
"settledNano": "<string>"
}
],
"nextPageToken": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
This API uses OAuth2 with the Client Credential flow. Client Credentials must be sent in the BODY, not the headers. For an example of how to implement this, refer to the c1TokenSource.Token() function.
Body
GetAttributionRollupsRequest specifies how to group settled spend.
Dimension used to group settled calls.
ATTRIBUTION_DIMENSION_UNSPECIFIED, ATTRIBUTION_DIMENSION_USER, ATTRIBUTION_DIMENSION_DEPARTMENT, ATTRIBUTION_DIMENSION_AGENT, ATTRIBUTION_DIMENSION_SESSION, ATTRIBUTION_DIMENSION_MODEL, ATTRIBUTION_DIMENSION_CALL_SOURCE, ATTRIBUTION_DIMENSION_SUBJECT_FUND_SOURCE, ATTRIBUTION_DIMENSION_APP AttributionFilters narrows settled usage before grouping. All predicates are exact matches and combine with AND; values within one list combine with OR.
Show child attributes
Show child attributes
Maximum number of groups to return. The default is 25 and the maximum is 100.
Pagination token from a previous response with the same window, dimension, and filters.
Response
GetAttributionRollupsResponse contains one page of ranked attribution groups.
Was this page helpful?