# The calling token and what it reaches

GET

/token

```js
const url = 'https://zkao.io/api/v1/token';
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);
}
```

```sh
curl --request GET \
  --url https://zkao.io/api/v1/token \
  --header 'Authorization: Bearer <token>'
```

* Production`zkao.io/api/v1/token`
* Staging`staging.zkao.io/api/v1/token`

Any valid token may call this, whatever its scopes. Use it to learn which project and organization a token belongs to. For an organization token, `kind` is `organization` and `project` is null.

## Authorizations

* **[bearerAuth](https://docs.staging.zkao.io/api/#bearerauth)**

## Responses

### 200

OK

application/json

object

* **id**

  required

  string

* **kind**

  required

  `organization`: the token reaches every project of `organization`, and `project` is null.

  string

  Allowed values: project organization

* **name**

  required

  string

* **scopes**

  required

  Array\<string>

* **repositoryIds**

  required

  Repositories the token is restricted to. Empty means every repository it reaches.

  Array\<string>

* **expiresAt**

  required

  string | null format: date-time

* **spendLimitCredits**

  required

  Credits this token may spend. Null means no limit.

  integer | null

* **organization**

  required

  The organization a project belongs to. Credits are held and billed at this level and shared by every project in it.

  object

  * **id**

    required

    string

  * **slug**

    required

    URL segment of the organization (`/orgs/<slug>`), unique across zkao.

    string

  * **name**

    required

    string

* **project**

  required

  Null for an organization token.

  object

  * **id**

    required

    string

  * **slug**

    required

    string

  * **name**

    required

    string

  * **organization**

    required

    The organization a project belongs to. Credits are held and billed at this level and shared by every project in it.

    object

    * **id**

      required

      string

    * **slug**

      required

      URL segment of the organization (`/orgs/<slug>`), unique across zkao.

      string

    * **name**

      required

      string

##### Example

```json
{
  "kind": "project"
}
```

### 401

Missing, malformed, expired, or revoked token

application/json

object

* **error**

  required

  object

  * **code**

    required

    string

    Allowed values: unauthorized forbidden not_found bad_request conflict insufficient_credits budget_below_minimum repository_initializing diff_base_required diff_base_not_allowed diff_base_invalid diff_empty rate_limited internal

  * **message**

    required

    string

  * **minimumCredits**

    Budget_below_minimum only: the least the launch could have reserved, in credits. A diff scan’s first scan of a repository also builds its overview, so its minimum is higher.

    integer

##### Example

```json
{
  "error": {
    "code": "unauthorized"
  }
}
```
