> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://americancloud.com/docs/api/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://americancloud.com/docs/api/_mcp/server.

# Get the caller identity and permissions

GET https://api.americancloud.com/api/v1/whoami

Returns the kind of credential, the account, and the permissions that the credential has now. For an API token, also its name, last four characters, expiry and last use.

Reference: https://americancloud.com/docs/api/api-reference/whoami/get-whoami

## Authentication

- `Authorization` header (bearer token, required) — API token, for example `amcld_...`. Create one in the dashboard.

## Response

### 200

- `kind` (enum, required) — The kind of credential: `api-token` for an API token, `legacy-api-key` for an API key header pair, `delegated` for an app that acts as a user, `first-party` for the dashboard.
  - Allowed values: `first-party`, `delegated`, `api-token`, `legacy-api-key`
- `account` (WhoamiAccountDto, required) — The account that the credential belongs to.
- `permissions` (list of string, required) — The permissions that the credential has now.
- `user` (AccountUserSummaryDto, optional) — The user, for the dashboard and for an app that acts as a user.
- `token` (WhoamiTokenDto, optional) — The API token, for an API token.
- `app` (WhoamiAppDto, optional) — The app, for an app that acts as a user.

## Errors

### 400 Bad Request Error

The request was malformed or failed validation.

- `statusCode` (double, required) — HTTP status code.
- `message` (ApiErrorDtoMessage, required) — Human-readable error message. A single string for most errors, or an array of strings when the request failed multiple validation checks.
- `error` (string, optional) — Short HTTP error label.
- `code` (string, optional) — Machine-readable reason for the error. Match on this value rather than on `message`, which can be reworded at any time. Present on the errors that have more than one cause for the same status code; omitted otherwise.
- `errors` (list of ValidationErrorItemDto, optional) — Per-field validation details. Present on 400 responses produced by request-body validation; omitted otherwise.
- `snapshots` (list of BlockingSnapshotDto, optional) — The snapshots that block a delete. Present on a 409 whose `code` is `volume_has_snapshots`; omitted otherwise.

### 401 Unauthorized Error

Authentication credentials were missing or invalid.

- `statusCode` (double, required) — HTTP status code.
- `message` (ApiErrorDtoMessage, required) — Human-readable error message. A single string for most errors, or an array of strings when the request failed multiple validation checks.
- `error` (string, optional) — Short HTTP error label.
- `code` (string, optional) — Machine-readable reason for the error. Match on this value rather than on `message`, which can be reworded at any time. Present on the errors that have more than one cause for the same status code; omitted otherwise.
- `errors` (list of ValidationErrorItemDto, optional) — Per-field validation details. Present on 400 responses produced by request-body validation; omitted otherwise.
- `snapshots` (list of BlockingSnapshotDto, optional) — The snapshots that block a delete. Present on a 409 whose `code` is `volume_has_snapshots`; omitted otherwise.

### 403 Forbidden Error

The authenticated principal is not permitted to perform this action.

- `statusCode` (double, required) — HTTP status code.
- `message` (ApiErrorDtoMessage, required) — Human-readable error message. A single string for most errors, or an array of strings when the request failed multiple validation checks.
- `error` (string, optional) — Short HTTP error label.
- `code` (string, optional) — Machine-readable reason for the error. Match on this value rather than on `message`, which can be reworded at any time. Present on the errors that have more than one cause for the same status code; omitted otherwise.
- `errors` (list of ValidationErrorItemDto, optional) — Per-field validation details. Present on 400 responses produced by request-body validation; omitted otherwise.
- `snapshots` (list of BlockingSnapshotDto, optional) — The snapshots that block a delete. Present on a 409 whose `code` is `volume_has_snapshots`; omitted otherwise.

### 404 Not Found Error

The requested resource does not exist or is not accessible to the caller.

- `statusCode` (double, required) — HTTP status code.
- `message` (ApiErrorDtoMessage, required) — Human-readable error message. A single string for most errors, or an array of strings when the request failed multiple validation checks.
- `error` (string, optional) — Short HTTP error label.
- `code` (string, optional) — Machine-readable reason for the error. Match on this value rather than on `message`, which can be reworded at any time. Present on the errors that have more than one cause for the same status code; omitted otherwise.
- `errors` (list of ValidationErrorItemDto, optional) — Per-field validation details. Present on 400 responses produced by request-body validation; omitted otherwise.
- `snapshots` (list of BlockingSnapshotDto, optional) — The snapshots that block a delete. Present on a 409 whose `code` is `volume_has_snapshots`; omitted otherwise.

### 500 Internal Server Error

An unexpected error occurred on the server.

- `statusCode` (double, required) — HTTP status code.
- `message` (ApiErrorDtoMessage, required) — Human-readable error message. A single string for most errors, or an array of strings when the request failed multiple validation checks.
- `error` (string, optional) — Short HTTP error label.
- `code` (string, optional) — Machine-readable reason for the error. Match on this value rather than on `message`, which can be reworded at any time. Present on the errors that have more than one cause for the same status code; omitted otherwise.
- `errors` (list of ValidationErrorItemDto, optional) — Per-field validation details. Present on 400 responses produced by request-body validation; omitted otherwise.
- `snapshots` (list of BlockingSnapshotDto, optional) — The snapshots that block a delete. Present on a 409 whose `code` is `volume_has_snapshots`; omitted otherwise.

## Types

### WhoamiAccountDto

- `id` (string, required) — Account ID.
- `name` (string, required) — Account name.

### AccountUserSummaryDto

- `id` (string, required) — User ID.
- `email` (string, required) — Email address of the user.
- `firstName` (string, required) — First name.
- `lastName` (string, required) — Last name.

### WhoamiTokenDto

- `id` (string, required) — ID of the API token.
- `name` (string, required) — Name of the API token.
- `tokenLast4` (string, required) — The last four characters of the token.
- `expiresAt` (datetime, optional) — When the token expires. Omitted for a token with no expiry.
- `lastUsedAt` (datetime, optional) — When the token was most recently used. Omitted if never used.

### WhoamiAppDto

- `clientId` (string, required) — The client ID of the app.
- `displayName` (string, required) — The name of the app.
- `originHost` (string, optional) — The web origin of the app, when the app registered itself.

### ApiErrorDtoMessage

Human-readable error message. A single string for most errors, or an array of strings when the request failed multiple validation checks.

- string
- list of string

### ValidationErrorItemDto

- `field` (string, required) — Dotted path to the field that failed validation.
- `message` (string, required) — Human-readable validation message for this field.

### BlockingSnapshotDto

- `id` (string, required) — Snapshot ID.
- `name` (string, required) — Snapshot name.

## Examples

**Response**

```json
{
  "kind": "api-token",
  "account": {
    "id": "string",
    "name": "Acme Inc."
  },
  "permissions": [
    "cmp:virtualmachines:read"
  ],
  "user": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "email": "jane@example.com",
    "firstName": "Jane",
    "lastName": "Smith"
  },
  "token": {
    "id": "string",
    "name": "terraform-ci",
    "tokenLast4": "x7Qa",
    "expiresAt": "2024-01-15T09:30:00Z",
    "lastUsedAt": "2024-01-15T09:30:00Z"
  },
  "app": {
    "clientId": "claude",
    "displayName": "Claude",
    "originHost": "grok.com"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.americancloud.com/api/v1/whoami"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.americancloud.com/api/v1/whoami';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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

```go
package main

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

func main() {

	url := "https://api.americancloud.com/api/v1/whoami"

	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(res)
	fmt.Println(string(body))

}
```

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

url = URI("https://api.americancloud.com/api/v1/whoami")

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
```

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

HttpResponse<String> response = Unirest.get("https://api.americancloud.com/api/v1/whoami")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.americancloud.com/api/v1/whoami', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.americancloud.com/api/v1/whoami");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

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

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()
```