> Call POST /v1/check before a tool that writes. DENY means do not invoke the tool. For clean Markdown of any page, append .md to the page URL. For the complete index, fetch https://docs.withwrit.com/llms.txt.

# List the tenant's principals

GET https://api.withwrit.com/v1/principals

API key required. Returns the tenant's identity directory — the
principals (teams, services, agents) its API keys are issued to —
oldest first, each with its live key count. Deleted principals are
excluded unless `include_deleted=1`; they stay resolvable by id
forever so old receipts keep their meaning. The first call also
lazily migrates the tenant: pre-directory keys are attached to an
auto-created "default" principal.


Reference: https://docs.withwrit.com/api-reference/principals/list-the-tenants-principals

## Servers

- `https://api.withwrit.com` (Writ gate, default)
- `https://j72ckh66ukck2kcbq3oiwxaalm0olxwb.lambda-url.us-east-1.on.aws` (Direct Lambda Function URL (fallback))

## Request

### Query parameters

- `include_deleted` (string, optional) — Set to 1 to include tombstoned principals.

## Response

### 200

The tenant's principal directory.

## Errors

### 401 Unauthorized Error

API key required — missing, malformed, or unknown key.

- `any`

## Examples

**Response**

```json
{
  "principals": [
    {
      "createdAt": 1759000000,
      "deletedAt": null,
      "disabled": false,
      "keyCount": 3,
      "name": "billing",
      "principalId": "prn_9d2f4a1b2c3d",
      "tenantId": "ten_3fa8b91c2d44"
    }
  ],
  "tenantId": "ten_3fa8b91c2d44"
}
```

**SDK Code**

```python Principals_listTheTenantsPrincipals_example
import requests

url = "https://api.withwrit.com/v1/principals"

response = requests.get(url)

print(response.json())
```

```javascript Principals_listTheTenantsPrincipals_example
const url = 'https://api.withwrit.com/v1/principals';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Principals_listTheTenantsPrincipals_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.withwrit.com/v1/principals"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Principals_listTheTenantsPrincipals_example
require 'uri'
require 'net/http'

url = URI("https://api.withwrit.com/v1/principals")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
```

```java Principals_listTheTenantsPrincipals_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.withwrit.com/v1/principals")
  .asString();
```

```php Principals_listTheTenantsPrincipals_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.withwrit.com/v1/principals');

echo $response->getBody();
```

```csharp Principals_listTheTenantsPrincipals_example
using RestSharp;

var client = new RestClient("https://api.withwrit.com/v1/principals");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift Principals_listTheTenantsPrincipals_example
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.withwrit.com/v1/principals")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```