Create a workspace
curl --request POST \
--url https://api.farthing.ai/v1/workspaces \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "acme",
"email": "you@example.com"
}
'import requests
url = "https://api.farthing.ai/v1/workspaces"
payload = {
"name": "acme",
"email": "you@example.com"
}
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: 'acme', email: 'you@example.com'})
};
fetch('https://api.farthing.ai/v1/workspaces', 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.farthing.ai/v1/workspaces",
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' => 'acme',
'email' => 'you@example.com'
]),
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://api.farthing.ai/v1/workspaces"
payload := strings.NewReader("{\n \"name\": \"acme\",\n \"email\": \"you@example.com\"\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://api.farthing.ai/v1/workspaces")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"acme\",\n \"email\": \"you@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.farthing.ai/v1/workspaces")
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\": \"acme\",\n \"email\": \"you@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"workspace": {
"id": "6f0f2f39-8a34-4a8f-9a1a-1d0f4b9a2c77",
"name": "acme",
"plan": "sandbox",
"sandboxOnly": true
},
"apiKey": "ck_test_3sQd7yQ0mHq9pP2rVwXk1tLb"
}Workspaces
Create a workspace
Creates the caller’s workspace — a sandbox tenant, their owner membership, and one ck_test_ key, atomically. One workspace per account.
Session-only. A key minting workspaces would be a privilege-escalation loop, so API keys are refused with 401.
POST
/
v1
/
workspaces
Create a workspace
curl --request POST \
--url https://api.farthing.ai/v1/workspaces \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "acme",
"email": "you@example.com"
}
'import requests
url = "https://api.farthing.ai/v1/workspaces"
payload = {
"name": "acme",
"email": "you@example.com"
}
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: 'acme', email: 'you@example.com'})
};
fetch('https://api.farthing.ai/v1/workspaces', 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.farthing.ai/v1/workspaces",
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' => 'acme',
'email' => 'you@example.com'
]),
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://api.farthing.ai/v1/workspaces"
payload := strings.NewReader("{\n \"name\": \"acme\",\n \"email\": \"you@example.com\"\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://api.farthing.ai/v1/workspaces")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"acme\",\n \"email\": \"you@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.farthing.ai/v1/workspaces")
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\": \"acme\",\n \"email\": \"you@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"workspace": {
"id": "6f0f2f39-8a34-4a8f-9a1a-1d0f4b9a2c77",
"name": "acme",
"plan": "sandbox",
"sandboxOnly": true
},
"apiKey": "ck_test_3sQd7yQ0mHq9pP2rVwXk1tLb"
}Authorizations
A dashboard session — the short-lived JWT a signed-in human holds at the dashboard, sent on the same Authorization: Bearer header. Dispatched by shape: a session token is a JWT, an API key starts with ck_. Sessions cannot be created through this API, and operations that list only this scheme refuse API keys with 401.
Body
application/json