Ana içeriğe geç
Version: 0.1.0

ConnectWiz API

SM AIBOT v2 is a multi-tenant (single database + Postgres Row-Level Security) customer communication and CRM platform.

This document is the single source of truth for the HTTP contract. The shared TypeScript types in @smaibot/ts-contracts and the rendered API reference are generated from this file. When the API changes, update this spec first, then regenerate the contracts.

Authentication​

The first-party admin SPA authenticates with Sanctum cookie / session (stateful) auth:

  1. GET /sanctum/csrf-cookie to obtain the XSRF-TOKEN cookie.
  2. POST /api/login (or /api/register) with credentials — the response sets the session cookie.
  3. Subsequent requests send the session cookie automatically and echo the CSRF token in the X-XSRF-TOKEN header.

Server-to-server / third-party integrations use a Bearer token (Sanctum personal access token) via the Authorization: Bearer <token> header.

Tenancy​

The tenant is never taken as a raw id from the client. For authenticated requests it is derived from the signed-in user. For public/pre-auth requests (login, register, password reset) it is resolved from the subdomain / slug.

Errors​

All error responses share the common Error envelope (see the Schemas section of this reference). Validation failures (HTTP 422) additionally include a field-keyed errors map, matching Laravel's validation error shape.

Rate limiting​

Responses to throttled endpoints include X-RateLimit-Limit, X-RateLimit-Remaining and (on 429) Retry-After headers. Limits are applied per-tenant and, for auth endpoints, per-credential.

Localization​

Send Accept-Language: en or Accept-Language: tr to negotiate the response language. Authenticated users' stored locale takes precedence, then the tenant default, then Accept-Language, then en.

Authentication​

Sanctum stateful SPA auth. The session cookie is set by /api/login or /api/register. Mutating requests must also send the CSRF token from the XSRF-TOKEN cookie in the X-XSRF-TOKEN header.

Security Scheme Type:

apiKey

Cookie parameter name:

smaibot_session

Contact

SM AIBOT:

URL: https://smaibot.com

License