Create a new service account
Creates a service account for granting access to non-human parties, along with its access key. The key is only returned once. Be sure to store it, as it cannot be retrieved later.
If the roles and permissions properties are omitted, the service account
defaults to admin level permissions. Otherwise, the specified level of
access is used.
Permissions
| Resource | Permission | Usage |
|---|---|---|
service_account | write | Creates the service account and its access key |
curl --request POST \
--url https://api.mezmo.com/v3/auth/service-account \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Terraform Provider Pipeline Provisioning",
"roles": [
"5b7ca8b2b59ba49d58cc79ac",
"5b8fa85cb59ba49d588942b3"
],
"expire_after": 14,
"description": "Used for provisioning pipelines via terraform",
"permissions": {
"view": {
"read": true,
"write": true,
"manage": false
}
}
}
'import requests
url = "https://api.mezmo.com/v3/auth/service-account"
payload = {
"name": "Terraform Provider Pipeline Provisioning",
"roles": ["5b7ca8b2b59ba49d58cc79ac", "5b8fa85cb59ba49d588942b3"],
"expire_after": 14,
"description": "Used for provisioning pipelines via terraform",
"permissions": { "view": {
"read": True,
"write": True,
"manage": False
} }
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Terraform Provider Pipeline Provisioning',
roles: ['5b7ca8b2b59ba49d58cc79ac', '5b8fa85cb59ba49d588942b3'],
expire_after: 14,
description: 'Used for provisioning pipelines via terraform',
permissions: {view: {read: true, write: true, manage: false}}
})
};
fetch('https://api.mezmo.com/v3/auth/service-account', 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.mezmo.com/v3/auth/service-account",
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' => 'Terraform Provider Pipeline Provisioning',
'roles' => [
'5b7ca8b2b59ba49d58cc79ac',
'5b8fa85cb59ba49d588942b3'
],
'expire_after' => 14,
'description' => 'Used for provisioning pipelines via terraform',
'permissions' => [
'view' => [
'read' => true,
'write' => true,
'manage' => false
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.mezmo.com/v3/auth/service-account"
payload := strings.NewReader("{\n \"name\": \"Terraform Provider Pipeline Provisioning\",\n \"roles\": [\n \"5b7ca8b2b59ba49d58cc79ac\",\n \"5b8fa85cb59ba49d588942b3\"\n ],\n \"expire_after\": 14,\n \"description\": \"Used for provisioning pipelines via terraform\",\n \"permissions\": {\n \"view\": {\n \"read\": true,\n \"write\": true,\n \"manage\": false\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.mezmo.com/v3/auth/service-account")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Terraform Provider Pipeline Provisioning\",\n \"roles\": [\n \"5b7ca8b2b59ba49d58cc79ac\",\n \"5b8fa85cb59ba49d588942b3\"\n ],\n \"expire_after\": 14,\n \"description\": \"Used for provisioning pipelines via terraform\",\n \"permissions\": {\n \"view\": {\n \"read\": true,\n \"write\": true,\n \"manage\": false\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mezmo.com/v3/auth/service-account")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Terraform Provider Pipeline Provisioning\",\n \"roles\": [\n \"5b7ca8b2b59ba49d58cc79ac\",\n \"5b8fa85cb59ba49d588942b3\"\n ],\n \"expire_after\": 14,\n \"description\": \"Used for provisioning pipelines via terraform\",\n \"permissions\": {\n \"view\": {\n \"read\": true,\n \"write\": true,\n \"manage\": false\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"meta": {
"type": "<string>",
"page": {
"next": "<string>",
"previous": "<string>"
},
"pk": "<string>",
"links": {
"self": {
"list": {
"method": "get",
"uri": "https://api.mezmo.com/v3/auth/resource"
},
"detail": {
"method": "get",
"uri": "https://api.mezmo.com/v3/auth/resource/{resource_id}"
},
"update": {
"method": "patch",
"uri": "https://api.mezmo.com/v3/auth/resource/{resource_id}"
},
"replace": {
"method": "put",
"uri": "https://api.mezmo.com/v3/auth/resource/{resource_id}"
},
"create": {
"method": "post",
"uri": "https://api.mezmo.com/v3/auth/resource"
}
},
"related": {}
}
},
"data": {
"access_key": "<string>",
"service_account_id": "5b7ca8b2b59ba49d58cc79ac",
"token_id": "5b7ca8b2b59ba49d58cc79ac",
"name": "Terraform Provider Pipeline Provisioning",
"access_token": {
"name": "My First Access Token",
"trailer": "a3f1",
"token_id": "5b7ca8b2b59ba49d58cc79ac",
"created_at": "2026-01-15T12:00:00.000Z",
"modified_at": "2026-01-15T12:00:00.000Z",
"last_used_at": "2026-01-15T12:00:00.000Z",
"user_id": "5b7ca8b2b59ba49d58cc79ac",
"account_id": "5b7ca8b2b59ba49d58cc79ac",
"enterprise_id": "25ef43eae1",
"expire_at": "2026-01-15T12:00:00.000Z",
"type": "access",
"roles": [
"5b7ca8b2b59ba49d58cc79ac",
"5b8fa85cb59ba49d588942b3"
],
"permissions": {
"view": {
"read": true,
"write": true,
"manage": false
}
}
},
"created_at": "2026-01-15T12:00:00.000Z",
"modified_at": "2026-01-15T12:00:00.000Z",
"account_id": "5b7ca8b2b59ba49d58cc79ac",
"enterprise_id": "25ef43eae1",
"expire_after": 14,
"description": "Used for provisioning pipelines via terraform",
"roles": [
"5b7ca8b2b59ba49d58cc79ac",
"5b8fa85cb59ba49d588942b3"
],
"permissions": {
"view": {
"read": true,
"write": true,
"manage": false
}
},
"agent_id": "5b7ca8b2b59ba49d58cc79ac"
}
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}Authorizations
The primary authentication method for the Mezmo API.
Pass the key in the Authorization header in the format Token <ACCESS TOKEN>.
For example:
curl -H 'Authorization: Token <ACCESS TOKEN>'
This key is used for all APIs with the exception of ingest.
Body
A service account is a special type of account intended to represent a non-human user that needs to authenticate and be authorized to access data in APIs.
A service account is a special type of account intended to represent a non-human user that needs to authenticate and be authorized to access data in APIs.
A user friendly, name for a service account.
3 - 128^[a-zA-Z0-9_\-.\[\]() ]+$"Terraform Provider Pipeline Provisioning"
A list of role identifiers to grant to the service account
5024[
"5b7ca8b2b59ba49d58cc79ac",
"5b8fa85cb59ba49d588942b3"
]
The number of days after which tokens issued by a service account will expire.
1 <= x <= 36514
Additional information to provide further context around the use cases for the service account.
250"Used for provisioning pipelines via terraform"
Permissions represent the set of resources a particular entity has access to.
Show child attributes
Show child attributes
{
"view": {
"read": true,
"write": true,
"manage": false
}
}
Response
Response format containing a the newly created service account, in addition to the standard metadata object.
Response format containing a the newly created service account, in addition to the standard metadata object.
Contains additional contextual information about the api response.
Show child attributes
Show child attributes
A service account is a special type of account intended to represent a non-human user that needs to authenticate and be authorized to access data in APIs.
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://api.mezmo.com/v3/auth/service-account \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Terraform Provider Pipeline Provisioning",
"roles": [
"5b7ca8b2b59ba49d58cc79ac",
"5b8fa85cb59ba49d588942b3"
],
"expire_after": 14,
"description": "Used for provisioning pipelines via terraform",
"permissions": {
"view": {
"read": true,
"write": true,
"manage": false
}
}
}
'import requests
url = "https://api.mezmo.com/v3/auth/service-account"
payload = {
"name": "Terraform Provider Pipeline Provisioning",
"roles": ["5b7ca8b2b59ba49d58cc79ac", "5b8fa85cb59ba49d588942b3"],
"expire_after": 14,
"description": "Used for provisioning pipelines via terraform",
"permissions": { "view": {
"read": True,
"write": True,
"manage": False
} }
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Terraform Provider Pipeline Provisioning',
roles: ['5b7ca8b2b59ba49d58cc79ac', '5b8fa85cb59ba49d588942b3'],
expire_after: 14,
description: 'Used for provisioning pipelines via terraform',
permissions: {view: {read: true, write: true, manage: false}}
})
};
fetch('https://api.mezmo.com/v3/auth/service-account', 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.mezmo.com/v3/auth/service-account",
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' => 'Terraform Provider Pipeline Provisioning',
'roles' => [
'5b7ca8b2b59ba49d58cc79ac',
'5b8fa85cb59ba49d588942b3'
],
'expire_after' => 14,
'description' => 'Used for provisioning pipelines via terraform',
'permissions' => [
'view' => [
'read' => true,
'write' => true,
'manage' => false
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.mezmo.com/v3/auth/service-account"
payload := strings.NewReader("{\n \"name\": \"Terraform Provider Pipeline Provisioning\",\n \"roles\": [\n \"5b7ca8b2b59ba49d58cc79ac\",\n \"5b8fa85cb59ba49d588942b3\"\n ],\n \"expire_after\": 14,\n \"description\": \"Used for provisioning pipelines via terraform\",\n \"permissions\": {\n \"view\": {\n \"read\": true,\n \"write\": true,\n \"manage\": false\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.mezmo.com/v3/auth/service-account")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Terraform Provider Pipeline Provisioning\",\n \"roles\": [\n \"5b7ca8b2b59ba49d58cc79ac\",\n \"5b8fa85cb59ba49d588942b3\"\n ],\n \"expire_after\": 14,\n \"description\": \"Used for provisioning pipelines via terraform\",\n \"permissions\": {\n \"view\": {\n \"read\": true,\n \"write\": true,\n \"manage\": false\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mezmo.com/v3/auth/service-account")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Terraform Provider Pipeline Provisioning\",\n \"roles\": [\n \"5b7ca8b2b59ba49d58cc79ac\",\n \"5b8fa85cb59ba49d588942b3\"\n ],\n \"expire_after\": 14,\n \"description\": \"Used for provisioning pipelines via terraform\",\n \"permissions\": {\n \"view\": {\n \"read\": true,\n \"write\": true,\n \"manage\": false\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"meta": {
"type": "<string>",
"page": {
"next": "<string>",
"previous": "<string>"
},
"pk": "<string>",
"links": {
"self": {
"list": {
"method": "get",
"uri": "https://api.mezmo.com/v3/auth/resource"
},
"detail": {
"method": "get",
"uri": "https://api.mezmo.com/v3/auth/resource/{resource_id}"
},
"update": {
"method": "patch",
"uri": "https://api.mezmo.com/v3/auth/resource/{resource_id}"
},
"replace": {
"method": "put",
"uri": "https://api.mezmo.com/v3/auth/resource/{resource_id}"
},
"create": {
"method": "post",
"uri": "https://api.mezmo.com/v3/auth/resource"
}
},
"related": {}
}
},
"data": {
"access_key": "<string>",
"service_account_id": "5b7ca8b2b59ba49d58cc79ac",
"token_id": "5b7ca8b2b59ba49d58cc79ac",
"name": "Terraform Provider Pipeline Provisioning",
"access_token": {
"name": "My First Access Token",
"trailer": "a3f1",
"token_id": "5b7ca8b2b59ba49d58cc79ac",
"created_at": "2026-01-15T12:00:00.000Z",
"modified_at": "2026-01-15T12:00:00.000Z",
"last_used_at": "2026-01-15T12:00:00.000Z",
"user_id": "5b7ca8b2b59ba49d58cc79ac",
"account_id": "5b7ca8b2b59ba49d58cc79ac",
"enterprise_id": "25ef43eae1",
"expire_at": "2026-01-15T12:00:00.000Z",
"type": "access",
"roles": [
"5b7ca8b2b59ba49d58cc79ac",
"5b8fa85cb59ba49d588942b3"
],
"permissions": {
"view": {
"read": true,
"write": true,
"manage": false
}
}
},
"created_at": "2026-01-15T12:00:00.000Z",
"modified_at": "2026-01-15T12:00:00.000Z",
"account_id": "5b7ca8b2b59ba49d58cc79ac",
"enterprise_id": "25ef43eae1",
"expire_after": 14,
"description": "Used for provisioning pipelines via terraform",
"roles": [
"5b7ca8b2b59ba49d58cc79ac",
"5b8fa85cb59ba49d588942b3"
],
"permissions": {
"view": {
"read": true,
"write": true,
"manage": false
}
},
"agent_id": "5b7ca8b2b59ba49d58cc79ac"
}
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}{
"status": 449,
"code": "<string>",
"message": "<string>",
"context": "body",
"errors": [
{
"keyword": "<string>",
"params": {},
"message": "<string>",
"instance_path": null,
"schema_path": null,
"property_name": null
}
]
}
