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 owner role, but no email and no user id. 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. readsDrafts is false when the key reads published articles only. Any valid key may call it.

:::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
publishingKey boolean yes True when an admin approved the key as a publishing key, which changes live content without review
readsDrafts boolean yes True when the key reads articles with the status DRAFT or IN REVIEW. When the org setting Published pages only is on, only a key that can use article.create, article.update, article.propose, article.publish or article.place reads them. An agent without a key never reads them.
role string yes Current org role of the key owner: admin, editor, viewer, billing or guest. It is anonymous on the public endpoint of a docs host, which needs no key.
workspaces array items: WorkspaceAccess object yes The workspaces that the key reaches, sorted by name
writes string yes How the changes of the key to live content apply. none: the key cannot change content that readers see. review: the org reviews agent changes, so a change waits in a proposal for an editor. direct: the change is live at once.
{
  "blocked": [
    {
      "permission": "string",
      "reason": "string"
    }
  ],
  "boundWorkspace": "string",
  "key": {
    "expiresAt": "string",
    "name": "string",
    "prefix": "string"
  },
  "org": {
    "id": "string",
    "name": "string",
    "plan": "string"
  },
  "permissions": [
    "string"
  ],
  "publishingKey": true,
  "readsDrafts": true,
  "role": "string",
  "workspaces": [
    {
      "accessMode": "string",
      "id": "string",
      "name": "string"
    }
  ],
  "writes": "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
  }
}

:::