# What you may do here

`GET /v1/me`

Your organization, and what its agreement allows you on this server: its tier, how far
back and ahead a search may reach, how deep it may be paged, and when access ends. Not
who you are: your name and email are in your login, and the API does not repeat them.

It is answered like every other operation. An account under review gets
[`no-organization`](/docs/v1/problems/no-organization.md). On `api.reconnectchina.org`, an organization with sandbox access only
gets [`tier-served-elsewhere`](/docs/v1/problems/tier-served-elsewhere.md), and asks the sandbox.

## Request

It takes no parameters and no body.

## Samples

The request with no input given. The Python and Node samples run on a client logged in as the login pages show, and curl reads an access token from $TOKEN.

Logging in: [Logging in](/docs/login.md), or for a script, [Creating a token for a script](/docs/login/script-token.md).

Every API host serves these pages for its own API. The samples are written for production, https://api.reconnectchina.org, as the pages are before they know their host. On another host, such as the sandbox, use that host instead: in curl's URL and the Shell samples' `login=` line, and as `server` for the Python and Node clients, which log in there too.

### Python

```python
me = client.get_me()
```

### curl

```sh
curl 'https://api.reconnectchina.org/v1/me' \
  -H "Authorization: Bearer $TOKEN"
```

### Node

```js
const me = await client.getMe();
```

## Responses

### 200 · Success

Your organization and its agreement.

- `organization` · object

  The organization your account belongs to.

- `organization.name` · string

  Its name, to show.

- `agreement` · object

  What your organization's agreement allows you on the server that answers. Bounds that
  the agreement sets and this object does not name still hold, and are named when a
  request meets them.

- `agreement.tier` · string, up to 32 characters

  Your organization's tier, the kind of agreement it has: `partner`, `partner-standard`,
  `associate` or `sandbox`. It is a name we assign and keep: one never changes meaning,
  so branch on it, for example to show each tier in a way of your own. New tiers may
  appear; show one you do not know as it is.

- `agreement.earliestFrom` · string, up to 128 characters

  The earliest `from` a search may use here, as an instant expression such as
  `now-1y` or `1900-01-01`, the same that [`range-not-entitled`](/docs/v1/problems/range-not-entitled.md) names.

- `agreement.latestTo` · string, up to 128 characters

  The latest `to` a search may use here, as an instant expression such as
  `3000-01-01`.

- `agreement.depth` · integer, at least 1

  How many hits one search may page through here (see *Paging*). A search with more
  hits than this ends with a page that carries `"truncated": {"reason": "depth"}`.

- `agreement.until` · string · may be absent

  When your organization's access ends. Absent when the agreement sets no end.
  After it, every request is refused with [`access-ended`](/docs/v1/problems/access-ended.md).

### Errors

Every error is a problem document with the fields below. Its `type` names the problem, and is the address of the problem's page.

- `401` · [`unauthenticated`](/docs/v1/problems/unauthenticated.md)

  No access token, or one that is invalid or has expired ([`unauthenticated`](/docs/v1/problems/unauthenticated.md)). Refresh
  the access token and try again.

  Header `WWW-Authenticate`

  `Bearer`, as [RFC 6750](https://www.rfc-editor.org/rfc/rfc6750) specifies.

- `403` · [`no-organization`](/docs/v1/problems/no-organization.md) · [`multiple-organizations`](/docs/v1/problems/multiple-organizations.md) · [`organization-not-registered`](/docs/v1/problems/organization-not-registered.md) · [`not-entitled`](/docs/v1/problems/not-entitled.md) · [`access-ended`](/docs/v1/problems/access-ended.md) · [`tier-served-elsewhere`](/docs/v1/problems/tier-served-elsewhere.md) · [`suspended`](/docs/v1/problems/suspended.md)

  The account may not do this. `type` says why: the account belongs to no organization
  because its application is still under review ([`no-organization`](/docs/v1/problems/no-organization.md)) or it belongs to
  more than one ([`multiple-organizations`](/docs/v1/problems/multiple-organizations.md)), the organization has no access to the API
  ([`organization-not-registered`](/docs/v1/problems/organization-not-registered.md)) or not to this operation ([`not-entitled`](/docs/v1/problems/not-entitled.md)), the
  organization's access has ended ([`access-ended`](/docs/v1/problems/access-ended.md)), the organization's access is to
  another server of the API ([`tier-served-elsewhere`](/docs/v1/problems/tier-served-elsewhere.md), with that server's URL in
  `server`), or access has been suspended ([`suspended`](/docs/v1/problems/suspended.md), see *Errors and retrying*).

- `429` · [`rate-limited`](/docs/v1/problems/rate-limited.md)

  Too many requests, or too many at the same time ([`rate-limited`](/docs/v1/problems/rate-limited.md)), from your account,
  your organization, or your network address. Wait for `Retry-After` seconds, then send
  the same request again.

  Header `Retry-After`

  How many seconds to wait before sending the same request again.

- `431` · [`headers-too-large`](/docs/v1/problems/headers-too-large.md)

  The request's headers are too large ([`headers-too-large`](/docs/v1/problems/headers-too-large.md)). An access token is far
  below the limit, so look for a header your client adds.

- `503` · [`unavailable`](/docs/v1/problems/unavailable.md)

  The API is temporarily unavailable ([`unavailable`](/docs/v1/problems/unavailable.md)), because our servers are under
  pressure or briefly out of service. Wait for `Retry-After` seconds, then send the same
  request again.

  Header `Retry-After`

  How many seconds to wait before sending the same request again.

- `Any other` · [`internal`](/docs/v1/problems/internal.md)

  Any other error, as a problem document. Includes [`internal`](/docs/v1/problems/internal.md) (500), a failure on our
  side.

#### A problem document's fields

- `type` · string

  Identifies the problem; branch on this. One of the problem types under
  `https://api.reconnectchina.org/docs/v1/problems/`, named in each response's
  description and its `x-problem-types`, and listed in *Problem types*, for example
  `https://api.reconnectchina.org/docs/v1/problems/continuation-expired`. The URL is
  also the type's documentation.

- `title` · string

  A short, human-readable summary of the problem type.

- `status` · integer

  The HTTP status code.

- `detail` · string · may be absent

  A human-readable explanation of this occurrence.

- `errors` · list of objects · may be absent

  For [`invalid-request`](/docs/v1/problems/invalid-request.md), each part of the request that is not valid, and for
  [`range-not-entitled`](/docs/v1/problems/range-not-entitled.md), each end of the range that reaches too far. Each names
  the part in exactly one way: `pointer` for a part of the body, `parameter` for a
  part of the path. A part with several mistakes in it, such as a `term`, has an
  entry for each, and `span` says where in it each one is.

- `errors[].parameter` · string · may be absent

  The name of the path parameter, as this document names it, for example
  `name` in `/v1/saved_searches/{scope}/{name}`.

- `errors[].pointer` · string · may be absent

  A JSON Pointer ([RFC 6901](https://www.rfc-editor.org/rfc/rfc6901)) into
  the request body, for example `/levelIn/0`. Empty for the body as a whole.
  For the run of a saved search, it points into the search as it ran, as
  if the body had been `{"parameters": …}` with the saved parameters and
  your overrides: `/parameters/from` whether `from` was saved or sent.

- `errors[].span` · object · may be absent

  Where in a string a problem is: the characters from `start` up to, not including,
  `end`, counting from 0. Characters are Unicode code points, as `maxLength` counts
  them, so `低空经济` is four; a program that marks text in another unit converts, such
  as a browser, whose strings count a character outside the Basic Multilingual Plane
  as two. Equal `start` and `end` mark the place where something is missing, such as
  the end of a term that stops after `&&`.

- `errors[].span.start` · integer, at least 0

- `errors[].span.end` · integer, at least 0

- `errors[].detail` · string

- `earliestFrom` · string, up to 128 characters · may be absent

  For [`range-not-entitled`](/docs/v1/problems/range-not-entitled.md), the earliest `from` your organization may use, as an
  instant expression such as `now-1y` or `1900-01-01`.

- `latestTo` · string, up to 128 characters · may be absent

  For [`range-not-entitled`](/docs/v1/problems/range-not-entitled.md), the latest `to` your organization may use, as an
  instant expression such as `3000-01-01`.

- `server` · string · may be absent

  For [`tier-served-elsewhere`](/docs/v1/problems/tier-served-elsewhere.md), the server of this API that your account may use,
  one of `servers`, such as `https://sandbox.api.reconnectchina.org`.

### Example responses

200 · A partner, on \`api.reconnectchina.org\`

```json
{
  "organization": {
    "name": "Example China Research Institute"
  },
  "agreement": {
    "tier": "partner",
    "earliestFrom": "1900-01-01",
    "latestTo": "3000-01-01",
    "depth": 100000,
    "until": "2027-12-31T23:00:00Z"
  }
}
```

200 · An organization with sandbox access only, on the sandbox

```json
{
  "organization": {
    "name": "Example Reading Group"
  },
  "agreement": {
    "tier": "sandbox",
    "earliestFrom": "now-1y",
    "latestTo": "3000-01-01",
    "depth": 10000
  }
}
```

401 · No access token

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/unauthenticated",
  "title": "Unauthenticated",
  "status": 401,
  "detail": "The request carries no access token."
}
```

403 · An organization with sandbox access only, on production

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/tier-served-elsewhere",
  "title": "Served elsewhere",
  "status": 403,
  "detail": "Your organization's access is to https://sandbox.api.reconnectchina.org, not to this server.",
  "server": "https://sandbox.api.reconnectchina.org"
}
```

403 · An account whose application is still under review

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/no-organization",
  "title": "No organization",
  "status": 403,
  "detail": "Your account belongs to no organization."
}
```

429 · Too many requests from one address

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/rate-limited",
  "title": "Rate limited",
  "status": 429,
  "detail": "This address has sent too many requests."
}
```

431 · Headers over the limit

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/headers-too-large",
  "title": "Headers too large",
  "status": 431,
  "detail": "The request's headers are too large."
}
```

503 · The API cannot take the request now

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/unavailable",
  "title": "Unavailable",
  "status": 503,
  "detail": "The API cannot take this request at the moment."
}
```

default · An error on our side

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/internal",
  "title": "Internal error",
  "status": 500,
  "detail": "The request could not be processed."
}
```
