Create service account
Create, rotate, revoke, and disable organization-scoped service accounts and hashed tokens.
POST
/
api
/
headless
/
v1
/
organizations
/
{organizationId}
/
service-accounts
Create service account
curl --request POST \
--url https://api.forge.ai/api/headless/v1/organizations/{organizationId}/service-accounts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scopes": [
"<string>"
],
"reason": "<string>",
"idempotencyKey": "<string>"
}
'import requests
url = "https://api.forge.ai/api/headless/v1/organizations/{organizationId}/service-accounts"
payload = {
"name": "<string>",
"scopes": ["<string>"],
"reason": "<string>",
"idempotencyKey": "<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>',
scopes: ['<string>'],
reason: '<string>',
idempotencyKey: '<string>'
})
};
fetch('https://api.forge.ai/api/headless/v1/organizations/{organizationId}/service-accounts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.forge.ai/api/headless/v1/organizations/{organizationId}/service-accounts"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"reason\": \"<string>\",\n \"idempotencyKey\": \"<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))
}{
"serviceAccount": {
"id": "<string>",
"organizationId": "<string>",
"name": "<string>",
"description": "<string>",
"scopes": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"ownerConsoleUserId": "<string>",
"disabledAt": "2023-11-07T05:31:56Z",
"lastUsedAt": "2023-11-07T05:31:56Z",
"tokens": [
{
"id": "<string>",
"name": "<string>",
"tokenPrefix": "<string>",
"scopes": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"lastUsedAt": "2023-11-07T05:31:56Z",
"revokedAt": "2023-11-07T05:31:56Z"
}
]
},
"token": {
"id": "<string>",
"name": "<string>",
"token": "<string>",
"tokenPrefix": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}Authorizations
Enter a Forge service-account token or delegated OAuth access token. Mintlify adds the Bearer prefix.
Path Parameters
Body
application/json
⌘I
Create service account
curl --request POST \
--url https://api.forge.ai/api/headless/v1/organizations/{organizationId}/service-accounts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scopes": [
"<string>"
],
"reason": "<string>",
"idempotencyKey": "<string>"
}
'import requests
url = "https://api.forge.ai/api/headless/v1/organizations/{organizationId}/service-accounts"
payload = {
"name": "<string>",
"scopes": ["<string>"],
"reason": "<string>",
"idempotencyKey": "<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>',
scopes: ['<string>'],
reason: '<string>',
idempotencyKey: '<string>'
})
};
fetch('https://api.forge.ai/api/headless/v1/organizations/{organizationId}/service-accounts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.forge.ai/api/headless/v1/organizations/{organizationId}/service-accounts"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"reason\": \"<string>\",\n \"idempotencyKey\": \"<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))
}{
"serviceAccount": {
"id": "<string>",
"organizationId": "<string>",
"name": "<string>",
"description": "<string>",
"scopes": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"ownerConsoleUserId": "<string>",
"disabledAt": "2023-11-07T05:31:56Z",
"lastUsedAt": "2023-11-07T05:31:56Z",
"tokens": [
{
"id": "<string>",
"name": "<string>",
"tokenPrefix": "<string>",
"scopes": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"lastUsedAt": "2023-11-07T05:31:56Z",
"revokedAt": "2023-11-07T05:31:56Z"
}
]
},
"token": {
"id": "<string>",
"name": "<string>",
"token": "<string>",
"tokenPrefix": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}