· View as Markdown

Authentication tokens

See Authentication for when to use tokens. If you use an organization account, see Authentication for organizations instead.

Creates an authentication token

POST /api/v1/auth_tokens.json

Creates a new authentication token for API access using user credentials.

Headers

  • x-rwgps-api-key string required
    API key for identifying the client application

Request body application/json

  • user object required
    2 fields
    • email string required
      User email address
    • password string required
      User password

Response 201

  • auth_token object
    5 fields
    • auth_token string
    • api_key string
    • created_at date-time
    • updated_at date-time
    • user object
      7 fields
      • id integer
      • first_name string
      • last_name string
      • display_name string
      • email string
      • created_at date-time
      • updated_at date-time

Errors

  • 400 Bad request - invalid parameters
  • 401 Unauthorized - invalid credentials or API key
Request
curl \
  -H "x-rwgps-api-key: $API_KEY" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
  "user": {
    "email": "alex@example.com",
    "password": "{password}"
  }
}' \
  https://ridewithgps.com/api/v1/auth_tokens.json
Response 201
{
  "auth_token": {
    "auth_token": "c0cc78875f250604f9abac97712e314c",
    "api_key": "2704a8df",
    "created_at": "2000-01-01T12:00:00Z",
    "updated_at": "2000-01-01T12:00:00Z",
    "user": {
      "id": 123,
      "first_name": "Alex",
      "last_name": "Rider",
      "display_name": "Alex Rider",
      "email": "alex@example.com",
      "created_at": "2000-01-01T12:00:00Z",
      "updated_at": "2000-01-01T12:00:00Z"
    }
  }
}