Lalexi
APIReferenceConnecting numbers

Connect a number

Starts connecting a messenger number or bot of the type you name — what the channel tile under Settings → Channels → Add does. The answer is connect_url: a short-lived Lalexi page where the person whose number it is scans the QR code, enters the code from the messenger, or pastes the bot token. Open it in a browser (a new tab or a pop-up); start a new one for every attempt.

When the page is done, the channel appears in GET /channels with connected_by = you, and the channel.created webhook fires. Any member of the workspace may connect a number; GET /channel-types says which types this workspace may connect now.

HTTPcodemeaning
201the page to open
403channel_unavailablethis type is not open to the workspace yet
409connection_limit_reachedthe plan's number of connections is used up (details.limit, details.used)
422validation_failedtype is not a type you can connect
503upstream_unavailablethe messaging service did not answer; try again

At most 10 connects and reconnects a minute per key.

POST
/channels

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

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).

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://app.lalexi.com/v1/channels" \  -H "X-Workspace-Id: 7" \  -H "Content-Type: application/json" \  -d '{    "type": "whatsapp"  }'
{
  "type": "whatsapp",
  "connect_url": "http://example.com"
}
{
  "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": "connection_limit_reached",
    "message": "The workspace has connected as many numbers as its plan allows.",
    "details": {
      "limit": 3,
      "used": 3
    }
  }
}
{
  "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."
  }
}