Jump to content
Not connected, Your IP: 3.139.234.124

What is API?

FAQ
AirVPN application programming interface (API) allows our customers to access and control their accounts, using custom written software.

If you need some other kind of API please feel free to write in our forums.

API Syntax

https://airvpn.org/api/<service_name>/?key=<your_api_key>&format=<format>&<service_params>
  • (optional, default 'json') is the output format:
    • json : JSON format.
    • xml : XML format.
    • php : PHP, function serialize() and unserialize().
    • text : Plain text, key=value for each rows. Nested result grouped with .dot notation in key field.
  • is your API key. Generate a key from API page. If you are already logged in AirVPN website, this is optional. Use the key param if you plan to use our API in scripts.
  • is the service name, look below for additional reference.
Any service returns a 'result' field with 'ok' if successful or an 'error' message.

Dates are always in UTC.
Dates that end with "_date" are the dates in the MySql standard format, yyyy-mm-dd hh24:mi:ss.
Dates that end with "_unix" are the dates in UNIX timestamp (integer).


Do not send more than 600 requests every 10 minutes or we will ban your IP address.

Supported methods


Services

You can browse our API EXPLORER in our API settings page.




Service: userinfo
Access: Member only
Details about yourself, including connection details.

Params: None

Output:
  • user
    • login (login name)
    • register_date (date of registration on our website)
    • register_unix (date of registration on our website)
    • premium (boolean, if premium or not)
    • expiration_unix (date of expiration)
    • expiration_date (date of expiration)
    • expiration_days (days to the expiration)
    • last_attempt_unix (date of last attempt to connect to a VPN server)
    • posts (posts in forum)
    • credits (account credit)
    • last_post (date of last post in forum)
    • last_visit_unix (date of last visit on website)
    • last_activity_unix (date of last activity on website)
    • connected (boolean, if connected or not)
  • sessions (array of all sessions, ordered by connected_since)
    • vpn_ip (local IP address assigned, 10.*)
    • exit_ip (exit IP)
    • entry_ip (entry IP)
    • server_name (server name)
    • server_country (server country name)
    • server_country_code (server country code, ISO)
    • server_continent (server continent)
    • server_location (server location)
    • server_bw (server bandwidth: 100 for 100 Mbit/s, 1000 for 1 Gbit/s)
    • bytes_read (read bytes in the current session)
    • bytes_write (written bytes in the current session)
    • connected_since_unix (date of start of the current connection)
    • connected_since_date (date of start of the current connection)
    • speed_read (read bytes per second from client to server, upload for client)
    • speed_write (written bytes per second from server to client, download for client)
  • connection (it's the first session above, for compatibility)



Service: notification
Access: Member only

Send a message to yourself.
Choose in the notifications options, under Air -> API, if you want to see it in the web site and/or in an e-mail.
Useful to write to yourself an event that needs attention, for example from a script.

Note: key required in any case.
Params:
  • subject
  • body
Output: None




Service: disconnect
Access: Member only
Requests a disconnection. If none of the filter parameters are specified, disconnect all sessions of the user.

Note: key required in any case.
Params:
  • server - Optional, if specified disconnect only sessions related to this server name.
  • device - Optional, if specified disconnect only sessions related to this device name.
Output: None




Service: status
Access: Free
The data available in our status page.

Params: None
Output: Try it. Some fields:
  • server_best is the recommended server
  • bw is the bandwidth used, in mbit/s
  • bw_max is the bandwidth available, in mbit/s
  • users is the number of users
  • servers is the number of servers
  • currentload is a percentage of current load
  • health: Can be ok, warning or error. If a server is in error status, it doesn't accept connection. For example, a low packet loss may cause a warning status, a high packet loss or maintenance may cause an error status.
  • warning: Only exists if health isn't ok, it's the reason.
Created: ..., last update: ...
×
×
  • Create New...