Agencies
Create agency
Create a new agency. Agencies group multiple client tenants under a single management entity. Returns 409 Conflict if an agency with the same name already exists.
curl -X POST "https://api.mythic-analytics.com/api/v1/agencies" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"name": "Digital Growth Partners",
"email": "admin@dgp-agency.com",
"phone": "+1-212-555-0100",
"website": "https://dgp-agency.com",
"metadata": {}
}'
import requests
import json
url = "https://api.mythic-analytics.com/api/v1/agencies"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"name": "Digital Growth Partners",
"email": "admin@dgp-agency.com",
"phone": "+1-212-555-0100",
"website": "https://dgp-agency.com",
"metadata": {}
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.mythic-analytics.com/api/v1/agencies", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"name": "Digital Growth Partners",
"email": "admin@dgp-agency.com",
"phone": "+1-212-555-0100",
"website": "https://dgp-agency.com",
"metadata": {}
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"name": "Digital Growth Partners",
"email": "admin@dgp-agency.com",
"phone": "+1-212-555-0100",
"website": "https://dgp-agency.com",
"metadata": {}
}`)
req, err := http.NewRequest("POST", "https://api.mythic-analytics.com/api/v1/agencies", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.mythic-analytics.com/api/v1/agencies')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
request.body = '{
"name": "Digital Growth Partners",
"email": "admin@dgp-agency.com",
"phone": "+1-212-555-0100",
"website": "https://dgp-agency.com",
"metadata": {}
}'
response = http.request(request)
puts response.body
{
"success": true,
"data": {
"id": "agc_7kH3nPqR",
"name": "Digital Growth Partners",
"email": "admin@dgp-agency.com",
"phone": "+1-555-0123",
"website": "example_string",
"metadata": {},
"client_count": 15,
"created_at": "2024-02-10T14:00:00.000Z",
"updated_at": "2024-06-01T09:15:00.000Z"
}
}
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
{
"error": "Conflict",
"message": "The request conflicts with the current state of the resource",
"code": 409,
"details": "Resource already exists"
}
POST
/agencies
POST
Security Scheme
Bearer Tokenstring
RequiredAdmin API key as bearer token. Format: Bearer YOUR_ADMIN_KEY
Admin API key as bearer token. Format:
Bearer YOUR_ADMIN_KEYContent-Typestring
RequiredThe media type of the request body
Options: application/json
namestring
RequiredAgency display name.
emailstring
Primary contact email.
Format: email
phonestring
Contact phone number.
websitestring
Agency website URL.
Format: uri
metadataobject
Arbitrary JSON metadata.
Request Preview
Response
Response will appear here after sending the request
Authentication
header
Authorizationstring
RequiredBearer token. Admin API key as bearer token. Format: Bearer YOUR_ADMIN_KEY
Body
application/json
namestring
RequiredAgency display name.
emailstring
Primary contact email.
phonestring
Contact phone number.
websitestring
Agency website URL.
metadataobject
Arbitrary JSON metadata.
Responses
Was this page helpful?
Built with Documentation.AI
Last updated today