# Sign in (beta)

> For the phone apps: signs a person in with their email and password and returns a token that works like a key with every scope, for that person in their company. Rate limited per address and per email. The person must have accepted the current Terms on the site.


`POST https://dev.siteswap.pro/api/v1/auth/session`

For the phone apps: signs a person in with their email and password and returns a token that works like a key with every scope, for that person in their company. Rate limited per address and per email. The person must have accepted the current Terms on the site.

## Body

- `email` (string, required)
- `password` (string, required)
- `device` (string): A name for the device, shown to the person

```json
{
  "email": "you@example.com",
  "password": "your password",
  "device": "iPhone"
}
```

## Responses

- 201: Created
- 400: bad_request, key_in_url or invalid_json: the request could not be read
- 413: too_large: the body is over 256 KB
- 429: rate_limited or daily_quota: wait for Retry-After seconds

## Response fields

- `token` (string): Send as `Authorization: Bearer`
- `expires_at` (string): It stops working then. ISO 8601 in UTC
- `company` (object | null)
- `company.slug` (string): The company's address on SiteSwap, `/c/{slug}`
- `company.name` (string)
- `company.kind` (string): What kind of company, for example `contractor` or `supplier`
- `company.url` (string): Its public page

```json
{
  "data": {
    "token": "string",
    "expires_at": "string",
    "company": {
      "slug": "string",
      "name": "string",
      "kind": "string",
      "url": "string"
    }
  },
  "meta": {
    "request_id": "3f9a1c0b7d2e",
    "api_version": "v1"
  }
}
```

## Example

```bash
curl -X POST "https://dev.siteswap.pro/api/v1/auth/session" \
  -H "Content-Type: application/json" \
  -d '{"email":"you@example.com","password":"your password","device":"iPhone"}'
```