Lalexi
APIReferenceUsage

Usage and limits

Messages sent over a period — paid (sent through Lalexi: replies, new dialogs, campaigns) and free (sent from your own phone and mirrored into Lalexi) — and where the workspace stands against its monthly message limit and its connection limit. The numbers of the Usage and Limits pages, and like them for administrators only: an agent's token gets 403 forbidden. Without from and to, the last 30 days.

GET
/usage

Authorization

personalToken
AuthorizationBearer <token>

Your personal access token from Profile → Access Token in Lalexi. It acts with exactly your role: what you may see and do in the workspace, and nothing more. Everything done with it is recorded as done by you.

In: header

Query Parameters

from?string

Start of the period, ISO 8601.

Formatdate-time
to?string

End of the period, ISO 8601; defaults to now.

Formatdate-time

Header Parameters

X-Workspace-Id?integer

The workspace to work in (an id from GET /me). Optional when you belong to a single workspace; required otherwise (400 workspace_required).

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://app.lalexi.com/v1/usage" \  -H "X-Workspace-Id: 7"
{
  "period": {
    "from": "2019-08-24T14:15:22Z",
    "to": "2019-08-24T14:15:22Z"
  },
  "messages": {
    "paid": 0,
    "free": 0,
    "limit": 0,
    "used_this_period": 0,
    "period_start": "2019-08-24T14:15:22Z",
    "limit_reached": true
  },
  "connections": {
    "limit": 0,
    "used": 0,
    "limit_reached": true
  }
}
{
  "error": {
    "code": "workspace_required",
    "message": "You belong to several workspaces: pass the X-Workspace-Id header."
  }
}
{
  "error": {
    "code": "invalid_api_key",
    "message": "The API key is missing or invalid."
  }
}
{
  "error": {
    "code": "forbidden",
    "message": "You are not allowed to do this."
  }
}
{
  "error": {
    "code": "not_found",
    "message": "Resource not found."
  }
}
{
  "error": {
    "code": "validation_failed",
    "message": "The request is invalid.",
    "details": {
      "email": [
        "is invalid"
      ]
    }
  }
}
{
  "error": {
    "code": "rate_limited",
    "message": "Too many requests. Retry after the number of seconds in Retry-After."
  }
}
{
  "error": {
    "code": "internal_error",
    "message": "Something went wrong on our side."
  }
}
{
  "error": {
    "code": "upstream_unavailable",
    "message": "The messaging service is unavailable. Nothing was sent; try again."
  }
}