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. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.
openapi: 3.2.0
info:
version: v1
title: RESTful API (JSON) Authenticate API
description: 'REST API is an easy and standardized way to work with SureSMS SMS gateway.
The API uses RESTful protocol, OAuth2 (password) for authentication and responses are in JSON format.
You can use JavaScript (and other programming languages) to GET (query), POST (send) or DELETE your messages.'
servers:
- url: https://apiv2.suresms.com/json
tags:
- name: Authenticate
paths:
/token:
post:
tags:
- Authenticate
summary: Authenticate (OAuth2)
description: 'API uses OAuth2 (via SSL) to authenticate and authorize the user.
It currently supports ''Resource Owner Password Credentials'' i.e. the ''password'' grant type (other grants are planned in the future).
By default, all tokens are set to expire in ''1 day''.
Note that (at the moment) the ''grant_type'' parameter will always be ''password''.'
responses:
'200':
description: User successfully authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/Token'
text/json:
schema:
$ref: '#/components/schemas/Token'
'400':
description: invalid grant - the user name or password is incorrect.
deprecated: false
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
grant_type:
type: string
enum:
- password
default: password
username:
type: string
password:
type: string
format: password
required:
- grant_type
- username
- password
operationId: postToken
x-operation-id-source: derived
components:
schemas:
Token:
title: Token
description: The JSON object returned as a result of successful authentication.
required:
- access_token
type: object
properties:
userName:
description: the user name token is issued to - i.e. your user name
type: string
access_token:
description: The access Token - <span style='color:blue;'><b>you need to send this back via the standard 'Bearer [token]' header</b></span>
type: string
token_type:
description: ''
default: bearer
enum:
- bearer
type: string
expires_in:
description: 'expires after # seconds. By default, all tokens are set to expire in ''1 day''.'
type: string
securitySchemes:
oauth2:
type: oauth2
flows:
password:
scopes:
read: Read access to protected resources
write: Write access to protected resources
tokenUrl: json/token
description: OAuth2 Password Grant