# Who am I

Source: https://www.jawsdeploy.net/rest-api/who-am-i | Section: Getting Started

Return the service account the request authenticated as, and the organization it belongs to.

`GET /api/me`

Returns the service account the request authenticated as, and the organization it belongs to. It takes no parameters and changes nothing.

This is the endpoint to point a new integration at first. A `200` here proves three things at once: the credentials are well formed, they are still active, and they resolve to the organization you expected. That last one is the useful part - it catches a pipeline wired up with the wrong environment's API key *before* it creates a release in somebody else's workspace, which is otherwise a mistake you find out about afterwards.

Every other endpoint in this reference authenticates exactly the same way, so if this call fails none of them will work either. That makes it the right thing to run first when something that used to work has stopped: it separates "the credentials are wrong" from "the request is wrong". See [Authentication](https://www.jawsdeploy.net/rest-api/authentication) for how the header is built, and [Errors and validation](https://www.jawsdeploy.net/rest-api/errors) for what a failure looks like.

### What the fields fall back to

`serviceAccountId` and `organizationId` come straight from the authenticated credentials and are always present. They are the two values worth asserting on in a pipeline.

The two names are looked up rather than carried, and each one has a fallback:

- `serviceAccountName` is the service account's display name, falling back to the `serviceAccountId` when no user record resolves. A response in which the name and the id are identical therefore means the lookup found nothing - not that somebody named the account after its own id.
- `organizationName` falls back to the organization name recorded on the service account, and is `null` when neither resolves.

`message` is a greeting assembled from `serviceAccountName`. It exists to make a manual `curl` readable and carries nothing the other fields do not. Do not parse it - it is the one field here whose wording is free to change.

### What it does not tell you

A `200` means the API answered and your credentials are good. It is not a service health check: it says nothing about whether agents are connected, whether a deployment slot is free, or whether anything can currently be deployed. Nor does it describe what the service account is *allowed* to do - roles are enforced per endpoint, so a call that succeeds here can still come back `401` from [Create a release](https://www.jawsdeploy.net/rest-api/releases-create) for want of a permission.

## Response fields

| Field | Type | Description |
|---|---|---|
| `message` | string | A human-readable greeting built from `serviceAccountName`, for eyeballing a manual request. Not machine-readable - do not parse it. |
| `serviceAccountId` | string | The id of the authenticated service account - the same value used as the username half of the Basic auth pair. Always present. |
| `serviceAccountName` | string | The account's display name, falling back to `serviceAccountId` when no user record resolves. |
| `organizationId` | string | The organization the credentials belong to. Always present, and the value to assert on when you want to be sure which tenant a pipeline is pointed at. |
| `organizationName` | string | That organization's name, or `null` when it cannot be resolved. |

## Errors

| Status | Meaning |
|---|---|
| 401 | Missing or invalid Basic auth credentials. There is no other failure mode - this endpoint takes no input to get wrong. |

Example request:

```
GET /api/me HTTP/1.1
Host: app.jawsdeploy.net
Authorization: Basic <base64(serviceAccountId:apiKey)>
```

Example response:

```
{
  "message": "Hello, Build agent!",
  "serviceAccountId": "usr_ci",
  "serviceAccountName": "Build agent",
  "organizationId": "org_acme",
  "organizationName": "Acme Corp"
}
```

