curl --request GET \
--url https://api.01ads.com/v1/auth/session \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.01ads.com/v1/auth/session"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.01ads.com/v1/auth/session', 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.01ads.com/v1/auth/session",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.01ads.com/v1/auth/session"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.01ads.com/v1/auth/session")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.01ads.com/v1/auth/session")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"user": {
"id": "<string>",
"email": "jsmith@example.com",
"name": "<string>",
"emailVerified": true,
"image": "<string>",
"role": "<string>"
},
"session": {
"expiresAt": "<string>"
},
"organization": {
"id": "<string>",
"slug": "<string>",
"name": "<string>",
"role": "admin"
},
"workspace": {
"id": "<string>",
"slug": "<string>",
"name": "<string>",
"region": "gcp-us-central1",
"role": "admin"
}
}{
"type": "about:blank",
"title": "Unauthorized",
"status": 401,
"detail": "Authentication required. Sign in and try again.",
"instance": "/v1/organizations",
"requestId": "2f6a9c3d-1e4b-4a8c-b7d2-5e0f1a2b3c4d"
}Read the current session
The user, the session, and the caller’s standing in the organization and workspace named by orgSlug / workspaceSlug (the Portal URL, ADR-0043), from the session cookie or the bearer token. A slug the caller cannot see answers null for that part; without orgSlug both are null. Answers null when nobody is signed in — being signed out is not an error. API keys are refused (401): sessions belong to people.
curl --request GET \
--url https://api.01ads.com/v1/auth/session \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.01ads.com/v1/auth/session"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.01ads.com/v1/auth/session', 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.01ads.com/v1/auth/session",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.01ads.com/v1/auth/session"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.01ads.com/v1/auth/session")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.01ads.com/v1/auth/session")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"user": {
"id": "<string>",
"email": "jsmith@example.com",
"name": "<string>",
"emailVerified": true,
"image": "<string>",
"role": "<string>"
},
"session": {
"expiresAt": "<string>"
},
"organization": {
"id": "<string>",
"slug": "<string>",
"name": "<string>",
"role": "admin"
},
"workspace": {
"id": "<string>",
"slug": "<string>",
"name": "<string>",
"region": "gcp-us-central1",
"role": "admin"
}
}{
"type": "about:blank",
"title": "Unauthorized",
"status": 401,
"detail": "Authentication required. Sign in and try again.",
"instance": "/v1/organizations",
"requestId": "2f6a9c3d-1e4b-4a8c-b7d2-5e0f1a2b3c4d"
}Authorizations
Session token as Authorization: Bearer (the CLI and scripts).
Query Parameters
Scope the answer to this organization (the one the Portal URL names). Omitted: the session's active organization
1"acme-corp"
With orgSlug: also resolve this workspace and the caller's effective role in it
1"eu-clients"
Response
The session, or null when anonymous
The session, or null when the caller is not signed in
Show child attributes
Show child attributes
Show child attributes
Show child attributes
The organization named by orgSlug (null when no slug was given or the caller is not a member of it)
Show child attributes
Show child attributes
The workspace named by workspaceSlug inside that organization, or null when no slug was given or the caller cannot view it
Show child attributes
Show child attributes
Was this page helpful?