Describe the key that calls
:::openapi-operation GET /api/v1/me AUTH bearerAuth :::
Returns the name, prefix and expiry of the key, its org and plan, and the role of its owner. It also lists the bound workspace, the workspaces that the key reaches and the permissions that it can use. blocked lists the permissions that the key holds but cannot use, with the reason: role, two_factor or plan. Any valid key may call it. The response holds no email and no user id.
:::codesamples open Code examples
curl -X GET "https://contextowl.co/api/v1/me" \
-H "Accept: application/json" \
-H "Authorization: Bearer <token>"
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.uri(URI.create("https://contextowl.co/api/v1/me"))
.header("Accept", "application/json")
.header("Authorization", "Bearer <token>")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
import urllib.request
url = "https://contextowl.co/api/v1/me"
headers = {
"Accept": "application/json",
"Authorization": "Bearer <token>",
}
data = None
req = urllib.request.Request(url, data=data, headers=headers, method="GET")
with urllib.request.urlopen(req) as res:
print(res.status)
print(res.read().decode())
const response = await fetch("https://contextowl.co/api/v1/me", {
method: "GET",
headers: {
"Accept": "application/json",
"Authorization": "Bearer <token>",
}
});
console.log(response.status);
console.log(await response.json());
package main
import (
"fmt"
"io"
"net/http"
"time"
)
func main() {
req, err := http.NewRequest("GET", "https://contextowl.co/api/v1/me", nil)
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Authorization", "Bearer <token>")
client := &http.Client{Timeout: 30 * time.Second}
res, err := client.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
bodyBytes, err := io.ReadAll(io.LimitReader(res.Body, 10<<20))
if err != nil {
panic(err)
}
fmt.Println(res.StatusCode)
fmt.Println(string(bodyBytes))
}
// cargo add reqwest --features blocking
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::blocking::Client::new();
let response = client.request(reqwest::Method::GET, "https://contextowl.co/api/v1/me")
.header("Accept", "application/json")
.header("Authorization", "Bearer <token>")
.send()?;
println!("{}", response.status());
println!("{}", response.text()?);
Ok(())
}
:::
:::details open Success responses (200)
200
Success
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
blocked |
array items: BlockedPermission object | yes | The permissions that the key holds but cannot use |
boundWorkspace |
string | no | The workspace that the key is bound to, or null for a key that is not bound |
key |
KeyInfo object | yes | - |
org |
IdentityOrg object | yes | - |
permissions |
array items: string | yes | The permissions that the key can use, sorted |
role |
string | yes | Current org role of the key owner: admin, editor, viewer, billing or guest |
workspaces |
array items: WorkspaceAccess object | yes | The workspaces that the key reaches, sorted by name |
{
"blocked": [
{
"permission": "string",
"reason": "string"
}
],
"boundWorkspace": "string",
"key": {
"expiresAt": "string",
"name": "string",
"prefix": "string"
},
"org": {
"id": "string",
"name": "string",
"plan": "string"
},
"permissions": [
"string"
],
"role": "string",
"workspaces": [
{
"accessMode": "string",
"id": "string",
"name": "string"
}
]
}
:::
:::details Error responses (401, 429, 500)
401
unauthorized: the access key is missing, invalid or expired.
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
error |
object | yes | - |
{
"error": {
"code": "string",
"details": null,
"message": "string",
"status": 0
}
}
429
rate_limited: too many requests. Wait for the time in the Retry-After header.
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
error |
object | yes | - |
{
"error": {
"code": "string",
"details": null,
"message": "string",
"status": 0
}
}
500
internal: the server failed.
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
error |
object | yes | - |
{
"error": {
"code": "string",
"details": null,
"message": "string",
"status": 0
}
}
:::