Get caller identity and projects
curl --request GET \
--url https://api.agents.writesonic.com/api/v1/business/whoami \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.agents.writesonic.com/api/v1/business/whoami"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.agents.writesonic.com/api/v1/business/whoami', 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.agents.writesonic.com/api/v1/business/whoami",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.agents.writesonic.com/api/v1/business/whoami"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.agents.writesonic.com/api/v1/business/whoami")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agents.writesonic.com/api/v1/business/whoami")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"identity": {
"id": "<string>",
"email": "<string>",
"full_name": "<string>",
"photo_url": "<string>",
"role": "super_admin",
"teams": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"role": "owner"
}
],
"subscription": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"is_active": true,
"subscription_for": "webapp",
"is_trial": true,
"current_period_start": "2023-11-07T05:31:56Z",
"current_period_end": "2023-11-07T05:31:56Z",
"cancel_at_period_end": true,
"user_seats": 123,
"plan": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"plan_type": "unlimited_words_plan",
"interval": "monthly",
"price": 123,
"currency_code": "USD",
"credits": 123,
"words": 123,
"is_unlimited": true
}
}
},
"active_workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"projects": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"owner_id": "<string>",
"root_website": "<string>",
"project_type": "STANDARD",
"project_scope": "domain",
"is_default": true,
"created_date": "2023-11-07T05:31:56Z",
"updated_date": "2023-11-07T05:31:56Z",
"has_access": true
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Identity & Project
Get caller identity and projects
Tells you who is calling: their identity, the HQ teams they belong to, and the projects in the workspace they are currently in.
Example: “Who am I? Show my account identity”
Usage: call this first, before anything else. It takes no input and it hands you the project ids you need to scope every other call to a specific project.
Response: your profile (name, email, role, teams), the active workspace id, and the list of projects in that workspace with each project’s id, name, and website.
GET
/
api
/
v1
/
business
/
whoami
Get caller identity and projects
curl --request GET \
--url https://api.agents.writesonic.com/api/v1/business/whoami \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.agents.writesonic.com/api/v1/business/whoami"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.agents.writesonic.com/api/v1/business/whoami', 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.agents.writesonic.com/api/v1/business/whoami",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.agents.writesonic.com/api/v1/business/whoami"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.agents.writesonic.com/api/v1/business/whoami")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agents.writesonic.com/api/v1/business/whoami")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"identity": {
"id": "<string>",
"email": "<string>",
"full_name": "<string>",
"photo_url": "<string>",
"role": "super_admin",
"teams": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"role": "owner"
}
],
"subscription": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"is_active": true,
"subscription_for": "webapp",
"is_trial": true,
"current_period_start": "2023-11-07T05:31:56Z",
"current_period_end": "2023-11-07T05:31:56Z",
"cancel_at_period_end": true,
"user_seats": 123,
"plan": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"plan_type": "unlimited_words_plan",
"interval": "monthly",
"price": 123,
"currency_code": "USD",
"credits": 123,
"words": 123,
"is_unlimited": true
}
}
},
"active_workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"projects": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"owner_id": "<string>",
"root_website": "<string>",
"project_type": "STANDARD",
"project_scope": "domain",
"is_default": true,
"created_date": "2023-11-07T05:31:56Z",
"updated_date": "2023-11-07T05:31:56Z",
"has_access": true
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Writesonic API key
Headers
Overrides the key's workspace
Response
Successful Response
Was this page helpful?