SMAO API Documentation
Usage

Get usage for a single organization

GET
/organizations/{organizationId}/usage
AuthorizationBearer <token>

Long-lived distributor API key scoped to a channel partner on the shared smao instance.

In: header

Path Parameters

organizationIdstring

MongoDB ObjectId of the organization.

Match^[a-fA-F0-9]{24}$

Query Parameters

fromstring

Start date in YYYY-MM-DD format, inclusive.

Formatdate
tostring

End date in YYYY-MM-DD format, inclusive.

Formatdate

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://api.smao.ai/api/distributor/v1/organizations/string/usage?from=2019-08-24&to=2019-08-24"
{
  "status": "success",
  "organization": {
    "id": "string",
    "name": "string",
    "externalCustomerId": "string"
  },
  "period": {
    "from": "2019-08-24T14:15:22Z",
    "to": "2019-08-24T14:15:22Z"
  },
  "usage": {
    "calls": {
      "count": 0,
      "minutes": 0
    },
    "forwards": {
      "count": 0,
      "minutes": 0
    },
    "assistants": 0,
    "sms": {
      "count": 0,
      "segments": 0
    },
    "whatsapp": 0
  }
}
{
  "status": "error",
  "errorCode": "INVALID_DATE_RANGE",
  "message": "from and to must be valid YYYY-MM-DD values"
}
{
  "status": "error",
  "errorCode": "INVALID_DATE_RANGE",
  "message": "from and to must be valid YYYY-MM-DD values"
}
{
  "status": "error",
  "errorCode": "INVALID_DATE_RANGE",
  "message": "from and to must be valid YYYY-MM-DD values"
}
{
  "status": "error",
  "errorCode": "INVALID_DATE_RANGE",
  "message": "from and to must be valid YYYY-MM-DD values"
}

{
  "status": "error",
  "errorCode": "RATE_LIMITED",
  "message": "Too many requests for this API key."
}
{
  "status": "error",
  "errorCode": "INVALID_DATE_RANGE",
  "message": "from and to must be valid YYYY-MM-DD values"
}

{
  "status": "error",
  "errorCode": "RATE_LIMIT_UNAVAILABLE",
  "message": "Rate limit storage is unavailable. Try again shortly."
}