Create an API key
curl --request POST \
--url https://prod.oneloop.ai/api/v1/api-key \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"workspaceId": "<string>",
"scopes": [
{
"representation": "<string>",
"create": true,
"read": true,
"update": true,
"del": true
}
],
"enabled": true,
"customerId": "<string>",
"prefix": "<string>",
"expiresAt": 1,
"externalMeterId": "<string>",
"metadata": {}
}
'import requests
url = "https://prod.oneloop.ai/api/v1/api-key"
payload = {
"name": "<string>",
"workspaceId": "<string>",
"scopes": [
{
"representation": "<string>",
"create": True,
"read": True,
"update": True,
"del": True
}
],
"enabled": True,
"customerId": "<string>",
"prefix": "<string>",
"expiresAt": 1,
"externalMeterId": "<string>",
"metadata": {}
}
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>',
workspaceId: '<string>',
scopes: [
{representation: '<string>', create: true, read: true, update: true, del: true}
],
enabled: true,
customerId: '<string>',
prefix: '<string>',
expiresAt: 1,
externalMeterId: '<string>',
metadata: {}
})
};
fetch('https://prod.oneloop.ai/api/v1/api-key', 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://prod.oneloop.ai/api/v1/api-key",
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>',
'workspaceId' => '<string>',
'scopes' => [
[
'representation' => '<string>',
'create' => true,
'read' => true,
'update' => true,
'del' => true
]
],
'enabled' => true,
'customerId' => '<string>',
'prefix' => '<string>',
'expiresAt' => 1,
'externalMeterId' => '<string>',
'metadata' => [
]
]),
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://prod.oneloop.ai/api/v1/api-key"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"workspaceId\": \"<string>\",\n \"scopes\": [\n {\n \"representation\": \"<string>\",\n \"create\": true,\n \"read\": true,\n \"update\": true,\n \"del\": true\n }\n ],\n \"enabled\": true,\n \"customerId\": \"<string>\",\n \"prefix\": \"<string>\",\n \"expiresAt\": 1,\n \"externalMeterId\": \"<string>\",\n \"metadata\": {}\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://prod.oneloop.ai/api/v1/api-key")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"workspaceId\": \"<string>\",\n \"scopes\": [\n {\n \"representation\": \"<string>\",\n \"create\": true,\n \"read\": true,\n \"update\": true,\n \"del\": true\n }\n ],\n \"enabled\": true,\n \"customerId\": \"<string>\",\n \"prefix\": \"<string>\",\n \"expiresAt\": 1,\n \"externalMeterId\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod.oneloop.ai/api/v1/api-key")
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 \"workspaceId\": \"<string>\",\n \"scopes\": [\n {\n \"representation\": \"<string>\",\n \"create\": true,\n \"read\": true,\n \"update\": true,\n \"del\": true\n }\n ],\n \"enabled\": true,\n \"customerId\": \"<string>\",\n \"prefix\": \"<string>\",\n \"expiresAt\": 1,\n \"externalMeterId\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"apiKey": {
"id": "<string>",
"name": "<string>",
"maskedKey": "<string>",
"prefix": "<string>",
"expiresAt": 1,
"scopes": [
{
"representation": "<string>",
"create": true,
"read": true,
"update": true,
"del": true,
"id": "<string>"
}
],
"enabled": true,
"customerId": "<string>",
"deleted": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"lastUsedAt": "<string>",
"billingId": "<string>",
"key": "<string>"
}
}{
"error": {
"code": 1,
"message": "<string>"
}
}{
"error": {
"code": 1,
"message": "<string>"
}
}{
"error": {
"code": 1,
"message": "<string>"
}
}API Keys
Create an API key
POST
/
api
/
v1
/
api-key
Create an API key
curl --request POST \
--url https://prod.oneloop.ai/api/v1/api-key \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"workspaceId": "<string>",
"scopes": [
{
"representation": "<string>",
"create": true,
"read": true,
"update": true,
"del": true
}
],
"enabled": true,
"customerId": "<string>",
"prefix": "<string>",
"expiresAt": 1,
"externalMeterId": "<string>",
"metadata": {}
}
'import requests
url = "https://prod.oneloop.ai/api/v1/api-key"
payload = {
"name": "<string>",
"workspaceId": "<string>",
"scopes": [
{
"representation": "<string>",
"create": True,
"read": True,
"update": True,
"del": True
}
],
"enabled": True,
"customerId": "<string>",
"prefix": "<string>",
"expiresAt": 1,
"externalMeterId": "<string>",
"metadata": {}
}
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>',
workspaceId: '<string>',
scopes: [
{representation: '<string>', create: true, read: true, update: true, del: true}
],
enabled: true,
customerId: '<string>',
prefix: '<string>',
expiresAt: 1,
externalMeterId: '<string>',
metadata: {}
})
};
fetch('https://prod.oneloop.ai/api/v1/api-key', 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://prod.oneloop.ai/api/v1/api-key",
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>',
'workspaceId' => '<string>',
'scopes' => [
[
'representation' => '<string>',
'create' => true,
'read' => true,
'update' => true,
'del' => true
]
],
'enabled' => true,
'customerId' => '<string>',
'prefix' => '<string>',
'expiresAt' => 1,
'externalMeterId' => '<string>',
'metadata' => [
]
]),
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://prod.oneloop.ai/api/v1/api-key"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"workspaceId\": \"<string>\",\n \"scopes\": [\n {\n \"representation\": \"<string>\",\n \"create\": true,\n \"read\": true,\n \"update\": true,\n \"del\": true\n }\n ],\n \"enabled\": true,\n \"customerId\": \"<string>\",\n \"prefix\": \"<string>\",\n \"expiresAt\": 1,\n \"externalMeterId\": \"<string>\",\n \"metadata\": {}\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://prod.oneloop.ai/api/v1/api-key")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"workspaceId\": \"<string>\",\n \"scopes\": [\n {\n \"representation\": \"<string>\",\n \"create\": true,\n \"read\": true,\n \"update\": true,\n \"del\": true\n }\n ],\n \"enabled\": true,\n \"customerId\": \"<string>\",\n \"prefix\": \"<string>\",\n \"expiresAt\": 1,\n \"externalMeterId\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod.oneloop.ai/api/v1/api-key")
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 \"workspaceId\": \"<string>\",\n \"scopes\": [\n {\n \"representation\": \"<string>\",\n \"create\": true,\n \"read\": true,\n \"update\": true,\n \"del\": true\n }\n ],\n \"enabled\": true,\n \"customerId\": \"<string>\",\n \"prefix\": \"<string>\",\n \"expiresAt\": 1,\n \"externalMeterId\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"apiKey": {
"id": "<string>",
"name": "<string>",
"maskedKey": "<string>",
"prefix": "<string>",
"expiresAt": 1,
"scopes": [
{
"representation": "<string>",
"create": true,
"read": true,
"update": true,
"del": true,
"id": "<string>"
}
],
"enabled": true,
"customerId": "<string>",
"deleted": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"lastUsedAt": "<string>",
"billingId": "<string>",
"key": "<string>"
}
}{
"error": {
"code": 1,
"message": "<string>"
}
}{
"error": {
"code": 1,
"message": "<string>"
}
}{
"error": {
"code": 1,
"message": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Response
The created key
Show child attributes
Show child attributes
⌘I