Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. See our Privacy Policy and
Terms.
openapi: 3.2.0
info:
title: Platform Stats API
description: The REST API specification for Ably.
version: 1.1.1
contact:
name: Ably Support
url: https://www.ably.io/contact
email: support@ably.io
servers:
- url: https://rest.ably.io
security:
- basicAuth: []
- bearerAuth: []
tags:
- name: Stats
paths:
/stats:
parameters:
- $ref: '#/components/parameters/versionHeader'
- $ref: '#/components/parameters/responseFormat'
get:
summary: Retrieve usage statistics for an application
operationId: getStats
description: The Ably system can be queried to obtain usage statistics for a given application, and results are provided aggregated across all channels in use in the application in the specified period. Stats may be used to track usage against account quotas.
tags:
- Stats
parameters:
- $ref: '#/components/parameters/filterStart'
- $ref: '#/components/parameters/filterLimit'
- $ref: '#/components/parameters/filterEnd'
- $ref: '#/components/parameters/filterDirection'
- name: unit
in: query
description: Specifies the unit of aggregation in the returned results.
schema:
type: string
default: minute
enum:
- minute
- hour
- day
- month
responses:
2XX:
description: OK
content:
application/json:
schema:
type: object
default:
$ref: '#/components/responses/Error'
/time:
parameters:
- $ref: '#/components/parameters/versionHeader'
- $ref: '#/components/parameters/responseFormat'
get:
security: []
summary: Get the service time
operationId: getTime
description: This returns the service time in milliseconds since the epoch.
tags:
- Stats
responses:
2XX:
description: OK
content:
application/json:
schema:
type: array
items:
type: integer
application/x-msgpack:
schema:
type: array
items:
type: integer
text/html:
schema:
type: string
default:
$ref: '#/components/responses/Error'
components:
headers:
ErrorCode:
description: The error code.
schema:
type: integer
ServerId:
description: The ID for the server communicated with.
schema:
type: string
required: true
ErrorMessage:
description: The error message.
schema:
type: string
parameters:
filterDirection:
name: direction
in: query
schema:
type: string
default: backwards
enum:
- forwards
- backwards
filterStart:
name: start
in: query
schema:
type: string
responseFormat:
in: query
name: format
schema:
type: string
enum:
- json
- jsonp
- msgpack
- html
description: The response format you would like
filterLimit:
name: limit
in: query
schema:
type: integer
default: '100'
filterEnd:
name: end
in: query
schema:
type: string
default: now
versionHeader:
in: header
name: X-Ably-Version
schema:
type: string
description: The version of the API you wish to use.
schemas:
Error:
type: object
description: Returned error from failed REST.
properties:
message:
type: string
description: Message explaining the error's cause.
code:
type: integer
description: Error code.
statusCode:
type: integer
description: Status error code.
href:
type: string
description: Link to help with error.
serverId:
type: string
description: Server ID with which error was encountered.
responses:
Error:
description: Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/x-msgpack:
schema:
$ref: '#/components/schemas/Error'
text/html:
schema:
$ref: '#/components/schemas/Error'
headers:
x-ably-errorcode:
$ref: '#/components/headers/ErrorCode'
x-ably-errormessage:
$ref: '#/components/headers/ErrorMessage'
x-ably-serverid:
$ref: '#/components/headers/ServerId'
securitySchemes:
basicAuth:
type: http
scheme: basic
description: Basic Authentication using an [API key](https://www.ably.io/documentation/core-features/authentication#basic-authentication).
bearerAuth:
type: http
scheme: bearer
description: Token Authentication using an [Ably Token](https://www.ably.io/documentation/core-features/authentication#basic-authentication), or optionally an [Ably JWT](https://www.ably.io/documentation/core-features/authentication#ably-jwt-process).
x-provenance:
method: harvested
publisher: Ably
source: https://raw.githubusercontent.com/ably/open-specs/main/definitions/platform-v1.yaml
note: split by refine-openapis from the provider's own published document, verified by fetch (openapi/_original/*.fetch.json);
stamped by stamp-openapi-provenance.py (roadmap#793)