IconicVPN App API v1.0.0
REST API for IconicVPN’s own apps: accounts, locations, devices and WireGuard connection settings.
- Base URL
- https://iconicvpn.com/api/app/v1
- Format
- JSON requests and responses (Content-Type: application/json), UTF-8, timestamps in ISO 8601 UTC
- OpenAPI 3
- /api/app/v1/openapi.json: generate Swift, Kotlin or TypeScript clients from this
- Transport
- HTTPS only, through Cloudflare. Pin nothing; use the system trust store.
Authentication
Apps sign in once with the customer's email and password and then stay signed in with tokens. Each app install gets its own session, which the customer can see and revoke.
- Sign in with POST /auth/login (or create an account with POST /auth/signup). Send a client object describing the app and device.
- Store the refresh token in the platform's secure storage (iOS Keychain, Android Keystore, Windows Credential Manager, macOS Keychain). Keep the access token in memory.
- Send Authorization: Bearer <access_token> on every authenticated request. Access tokens last 1 hour.
- When a request returns 401 invalid_token, or shortly before expires_in, call POST /auth/refresh. It returns a new pair; the old refresh token stops working immediately, so save the new one before using it. Refresh tokens expire after 90 days without use.
- If refresh returns 401 invalid_refresh_token, show the sign-in screen. This happens when the session was revoked, the password changed, or the account closed.
Only one refresh may be in flight per session: serialise refreshes in the app, otherwise the second request uses an already-rotated token and signs the app out.
curl -X POST https://iconicvpn.com/api/app/v1/auth/login \
-H 'Content-Type: application/json' \
-d '{"email":"[email protected]","password":"…","client":{"name":"IconicVPN for iOS","platform":"ios","app_version":"1.0.0","device_model":"iPhone 15"}}'
Google & Apple sign-in
“Continue with Google / Apple” runs in the user's browser, against IconicVPN, never inside the app: the app doesn't hold any Google or Apple secrets. It follows OAuth 2.0 for native apps (RFC 8252) with a loopback redirect and PKCE (RFC 7636). The result is the same token pair as a password sign-in.
- Call GET /auth/providers and show only the buttons that are true (treat a 404 as none).
- Start listening on http://127.0.0.1:<any free port>/<path>. Generate a random state and a PKCE code_verifier (43–128 characters); the code_challenge is its base64url SHA-256.
- Open GET /auth/oauth/{google|apple}/start?redirect_uri=…&state=…&code_challenge=…&code_challenge_method=S256 in the system browser. The user signs in with Google or Apple; IconicVPN finds their account (a verified email that matches an existing account signs into it) or creates one with the free trial.
- The browser comes back to your redirect_uri with code and state, or with error and error_description. Check state, then show the user a “you can close this tab” page.
- Within 60 seconds, POST /auth/oauth/token with the code, the code_verifier, the same redirect_uri and your client. Store the tokens exactly as after /auth/login. account_created: true means this was a new sign-up.
Codes work once. Mobile apps can use the same endpoints with a loopback redirect, or open them in ASWebAuthenticationSession / Custom Tabs.
open "https://iconicvpn.com/api/app/v1/auth/oauth/google/start?redirect_uri=http%3A%2F%2F127.0.0.1%3A53817%2Fcallback&state=…&code_challenge=…&code_challenge_method=S256"
# browser returns to http://127.0.0.1:53817/callback?code=…&state=…
curl -X POST https://iconicvpn.com/api/app/v1/auth/oauth/token \
-H 'Content-Type: application/json' \
-d '{"code":"…","code_verifier":"…","redirect_uri":"http://127.0.0.1:53817/callback","client":{"name":"IconicVPN for Windows","platform":"windows"}}'
Google sign-in on Android (ID token)
Android apps can skip the browser: Credential Manager gives the app a Google ID token whose audience is IconicVPN's Google Web client ID, and the app sends it to IconicVPN. The token is checked against Google's keys (signature, issuer, audience, expiry) and must carry a verified email.
- POST /auth/google with id_token and client. If the Google account is linked to a customer, or a customer has the same email (it is linked now), you get the same token pair as /auth/login.
- On 404 account_not_found there is no account yet. Show a “choose your plan” screen: the free trial, and the paid plans from GET /plans (bought on the website's /pricing/ page).
- For the free trial, POST /auth/google/signup with the same body. It creates the customer from the token's name and email, starts the trial and returns 201 with a token pair. 409 email_taken means the account exists: use /auth/google.
401 invalid_token usually means the token expired (they last about an hour): ask the user to pick their Google account again.
curl -X POST https://iconicvpn.com/api/app/v1/auth/google \
-H 'Content-Type: application/json' \
-d '{"id_token":"eyJhbGciOiJSUzI1NiIs…","client":{"name":"IconicVPN for Android","platform":"android","app_version":"0.1.0","device_model":"Google Pixel 7"}}'
App updates
Apps find out about new versions from GET /updates/{platform} (windows, android, ios or macos). It needs no token and may be cached for 5 minutes. Check shortly after start and then a couple of times a day, not on every launch of a screen.
- Compare latest_version with your own version part by part as numbers (0.10.0 is newer than 0.9.2; a missing fourth part counts as 0). If it's newer, offer download_url (open it in the browser) with release_notes.
- If your version is below minimum_version, the update is required: say so and don't let the notice be dismissed.
- 404 not_found means nothing is published for the platform: treat it as up to date. Ignore network errors unless the user asked to check.
curl https://iconicvpn.com/api/app/v1/updates/windows
Device keys
Each app install should register itself as one device (a WireGuard peer). Device counts are limited by the customer's plan; check GET /me → devices and can_add_devices.
- Recommended: keys on the device. Generate a Curve25519 key pair with the platform's WireGuard library, keep the private key in secure storage, and send only public_key to POST /devices. The private key never leaves the device, and /connect returns interface.private_key: null.
- Alternative: server-generated keys. Omit public_key. IconicVPN generates and stores the keys (encrypted), and /connect returns the private key plus a ready-made config file.
Store the returned device id. If the app is reinstalled and the private key is lost, register a new device and delete the old one.
Connecting & failover
- Show GET /locations in the location picker (or offer "Fastest" by sending no location).
- On connect, call POST /devices/{id}/connect with the chosen location_id. Call it every time the user connects rather than caching the result: this is where failover happens.
- Bring up WireGuard with interface (address, DNS, private key) and peer (server public key, preshared key, endpoint, allowed IPs, keepalive).
- If no handshake completes within ~10 seconds, try the servers in alternatives in order, then call /connect again.
How a server is chosen: servers in a location are ordered by priority. Any server whose average bandwidth over the last few minutes is above its limit is marked busy and skipped in favour of the next one; it's used again once traffic drops below the recovery level. If every server in a location is busy, the least-busy one is still returned, so connections keep working. Offline servers are never returned.
Newly registered devices reach servers within about 30 seconds. If the very first handshake fails right after POST /devices, wait a few seconds and retry.
Errors & limits
Errors use HTTP status codes with a JSON body: {"error": "device_limit_reached", "message": "…"}. Branch on error, which is stable. Show message to the user if you have nothing better.
| Status | Meaning |
|---|---|
| 400 | validation_error and similar: the request was malformed |
| 401 | invalid_token (refresh and retry), invalid_credentials, invalid_refresh_token (sign in again) |
| 403 | account_blocked (e.g. email not confirmed, account suspended), signup_closed, wrong_password |
| 404 | not_found |
| 409 | Conflicts such as device_limit_reached, no_active_subscription, email_taken, location_offline |
| 422 | Sign-up field errors, with a fields object |
| 429 | rate_limited: back off (respect Retry-After) and retry |
| 5xx | Temporary server problem: retry with exponential backoff |
Rate limits are per IP address: sign-in 10 per 15 minutes, sign-up 5 per hour, refresh 60 per hour, device registration 20 per hour, connect 120 per hour. Responses are never cacheable.
Meta
Service information and app updates. No authentication.
GET /api/app/v1/status public
Service status
Public. Use to check connectivity and whether sign-up is open before showing a sign-up screen.
Responses
- 200
api_version string server_time string (date-time) signup_open boolean trial_days integer | null
GET /api/app/v1/updates/{platform} public
Latest app version for a platform
Public, cacheable for 5 minutes. Compare `latest_version` with the installed version (numerically, part by part) and offer `download_url` when it is newer. Below `minimum_version` the app must be updated to keep working. 404 `not_found` when no release is published for the platform: treat it as up to date.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| platform | path | string: windows / android / ios / macos |
Responses
- 200
platform string: windows / android / ios / macos latest_version string Dotted numbers: major.minor.patch, optionally a fourth part minimum_version string | null Installed versions below this must update download_url string Open in the user’s browser release_notes string | null Plain text, a sentence or two published_at string (date-time) - 400 Error
- 404 Error
GET /api/app/v1/plans public
Plans on sale
Public. The paid plans shown on the website’s pricing page, in the same order, for a “choose your plan” screen. To buy one, a signed-in app calls POST /billing/checkout-link and opens the link in the browser. Empty when none are on sale.
Responses
- 200 array of PlanOffer
Authentication
Sign up, sign in (email and password, Google or Apple) and keep the app signed in with rotating refresh tokens.
POST /api/app/v1/auth/signup public
Create an account (starts the free trial)
Creates the customer with a free trial, signs this app in and emails a confirmation link. With `client.platform` `ios` the account gets no free trial from the server: it has no subscription (GET /me `blocker`: “Choose a plan to start your free trial.”) until an App Store purchase arrives, whose own free trial applies. Returns 403 `signup_closed` if sign-ups are off, 409 `email_taken` if the email has an account, 422 `validation_error` with `fields` for bad input.
Request body
| Field | Type | Description |
|---|---|---|
| name * | string | |
| email * | string | |
| password * | string | |
| client | ClientInfo | |
| start_trial | boolean | `false` from the Google Play build: the account starts with no subscription (GET /me `blocker`: “Choose a plan to start your free trial.”), because the free trial comes with the Google Play subscription |
Responses
POST /api/app/v1/auth/login public
Sign in with email and password
Creates a new app session. Call once per install and keep the refresh token; don’t log in on every launch. Accounts moved from the old system have no password yet: the reply is 401 `password_not_set` and the customer is emailed a link to choose one. An account whose password was set by IconicVPN staff gets 403 `password_change_required` until the customer chooses their own on the website. Show the `message` to the customer in both cases.
Request body
| Field | Type | Description |
|---|---|---|
| email * | string | |
| password * | string | |
| client | ClientInfo |
Responses
POST /api/app/v1/auth/refresh public
Exchange a refresh token for a new token pair
Refresh tokens are single-use: the response contains a new refresh token and the old one stops working. Returns 401 `invalid_refresh_token` if it was revoked, expired or already used. The app should then send the user to the sign-in screen.
Request body
| Field | Type | Description |
|---|---|---|
| refresh_token * | string | |
| client | ClientInfo |
Responses
POST /api/app/v1/auth/forgot-password public
Email a password reset link
Always returns 202, whether or not the email has an account. The link opens the web portal.
Request body
| Field | Type | Description |
|---|---|---|
| email * | string |
Responses
- 202
ok boolean - 429 Error
GET /api/app/v1/auth/providers public
Sign-in providers available
Public. Which “Continue with …” buttons to show. A provider is `true` only when it is fully configured on this server. Treat a 404 (older server) as all `false`.
Responses
- 200
google boolean apple boolean
GET /api/app/v1/auth/oauth/{provider}/start public
Start Google or Apple sign-in (open in the browser)
Open this URL in the user’s browser, not with the app’s HTTP client. The app listens on a loopback port first; after the user signs in, the browser is sent to `redirect_uri` with `code` and `state` (or `error`, `error_description` and `state`). Swap the code with POST /auth/oauth/token within 60 seconds.
An invalid `redirect_uri` or `state` shows an error page and never redirects. Other problems redirect back with `error`: `invalid_request`, `provider_unavailable`, `access_denied` (the user cancelled), `email_not_verified`, `account_closed`, `signup_closed`, `provider_error`. A sign-in that isn’t finished within 10 minutes expires.
The iOS app adds `platform=ios`: an account this sign-in creates then gets no free trial from the server (no subscription until an App Store purchase, whose own free trial applies). Other apps leave it out.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| redirect_uri | query | string | Loopback URL the app listens on: `http://127.0.0.1:<port>/<path>`, `http://[::1]:<port>/<path>` or `http://localhost:<port>/<path>` |
| state | query | string | Random value from the app, returned unchanged. Check it on the way back. |
| code_challenge | query | string | Base64url (no padding) SHA-256 of the app’s code_verifier |
| code_challenge_method | query | string: S256 | |
| platform? | query | string | Optional. `ios` from the iOS app: a new account gets no server free trial (it starts with the App Store purchase). |
| provider | path | string: google / apple |
Responses
- 302
- 400
GET /api/app/v1/auth/oauth/google/callback public
Google sign-in return (called by Google)
Register this URL in the Google OAuth client’s “Authorised redirect URIs”. Apps never call it.
Responses
- 302
POST /api/app/v1/auth/oauth/apple/callback public
Apple sign-in return (form post from Apple)
Register this URL as a “Return URL” on the Apple Services ID. Apps never call it.
Responses
- 302
POST /api/app/v1/auth/oauth/token public
Swap a Google/Apple sign-in code for tokens
Send the `code` the browser brought back to the app, the PKCE `code_verifier` and the same `redirect_uri` used with /start. Codes work once, within 60 seconds. Returns the same token pair as /auth/login plus `account_created` (true when this sign-in created the account; it started the server’s free trial unless /start had `platform=ios`). 400 `invalid_grant` when the code is unknown, expired, used, or the verifier or redirect URI don’t match.
Request body
| Field | Type | Description |
|---|---|---|
| code * | string | |
| code_verifier * | string | The secret whose SHA-256 was sent as code_challenge |
| redirect_uri * | string | e.g. "http://127.0.0.1:53817/callback" |
| client | ClientInfo |
Responses
- 200 OAuthTokenPair
- 400 Error
- 429 Error
POST /api/app/v1/auth/google public
Sign in with a Google ID token
For apps that get a Google ID token themselves (Android Credential Manager). Signs in the customer linked to this Google account, or the customer with the same (Google-verified) email, linking the Google account to them. Returns the same token pair as /auth/login.
Doesn’t create accounts: 404 `account_not_found` means there is no customer for this Google account or its email. Offer the free trial (POST /auth/google/signup) or the plans on the website. Other errors: 401 `invalid_token` (bad signature, wrong `aud`/`iss`, or expired; ask the user to pick their Google account again), 403 `email_not_verified`, 403 `account_closed`, 503 `provider_unavailable`.
Request body
| Field | Type | Description |
|---|---|---|
| id_token * | string | Google ID token (JWT) whose audience is IconicVPN’s Google Web client ID |
| client | ClientInfo |
Responses
POST /api/app/v1/auth/google/signup public
Create an account from a Google ID token (starts the free trial)
The Google version of POST /auth/signup: verifies the token as POST /auth/google does, creates the customer with the name and email from the token (already verified, no password: they can set one with “Forgot password”), starts the free trial (none with `start_trial: false` or `client.platform` `ios`: see POST /auth/signup), links the Google account and signs this app in. Errors: 401 `invalid_token`, 403 `email_not_verified`, 403 `signup_closed` (sign-ups are off), 409 `email_taken` (an account already exists for this email or Google account; sign in with POST /auth/google instead).
Request body
| Field | Type | Description |
|---|---|---|
| id_token * | string | Google ID token (JWT) whose audience is IconicVPN’s Google Web client ID |
| client | ClientInfo | |
| start_trial | boolean | `false` from the Google Play build: the account starts with no subscription, because the free trial comes with the Google Play subscription |
Responses
POST /api/app/v1/auth/logout bearer token
Sign this app out
Revokes the current session’s tokens.
Responses
- 204 no content
- 401 Error
Account
The signed-in customer, their subscription and app sessions.
GET /api/app/v1/me bearer token
Account, subscription and device allowance
Responses
PATCH /api/app/v1/me bearer token
Update profile
Request body
| Field | Type | Description |
|---|---|---|
| name * | string |
Responses
POST /api/app/v1/me/password bearer token
Change password
Signs out every other app session. This session stays signed in.
Request body
| Field | Type | Description |
|---|---|---|
| current_password * | string | |
| new_password * | string |
Responses
POST /api/app/v1/me/resend-verification bearer token
Resend the email confirmation link
Responses
POST /api/app/v1/me/portal-link bearer token
One-tap sign-in link to the client area
Returns a link that signs the customer into the website client area, for a “Manage services” or “Delete account” button. `page` picks where it opens: `my_vpn` (the default), `account`, or `delete_account` (the Account page’s Delete account section, which satisfies the stores’ in-app account deletion rule from a single button). Open it in the browser straight away: it works once and expires after 10 minutes (an expired link shows the login page, which then goes to the same page). Asking for a new link cancels the previous one.
Request body
| Field | Type | Description |
|---|---|---|
| page | string: my_vpn / account / delete_account / billing / renew |
Responses
POST /api/app/v1/me/delete bearer token
Delete the account permanently
For the in-app “Delete account” option that the App Store and Google Play require. Ask the customer to confirm, then send `confirm: "DELETE"`. Deletes the account, its devices (they stop connecting within a minute), app sessions and sign-in details, and emails a confirmation. A paid subscription with the billing system is cancelled first; if that fails nothing is deleted and the response is 409 `billing_cancel_failed`. App Store and Google Play subscriptions can’t be cancelled by IconicVPN: before deleting, tell the customer to cancel theirs in the store (the confirmation email says so too). Billing records stay in the billing system for 6 years as the law requires. After 204 the app should discard its tokens and return to the sign-in screen. The public page https://iconicvpn.com/delete-account does the same for people who can’t sign in.
Request body
| Field | Type | Description |
|---|---|---|
| confirm * | string | e.g. "DELETE" |
Responses
GET /api/app/v1/sessions bearer token
List signed-in app sessions
Responses
DELETE /api/app/v1/sessions/{id} bearer token
Sign out an app session
Use to sign out a lost device. Revoking the current session works like /auth/logout.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| id | path | integer |
Responses
Servers
Locations and servers available on the customer’s plan, with live load.
GET /api/app/v1/locations bearer token
Locations available on the customer’s plan
Show these in the location picker. Available locations come first.
Responses
GET /api/app/v1/servers bearer token
Individual servers with live load
For advanced pickers. Most apps only need /locations plus /connect.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| location_id? | query | string |
Responses
Devices
WireGuard devices (peers) on the account. Each app install should register one device.
GET /api/app/v1/devices bearer token
List devices
Responses
POST /api/app/v1/devices bearer token
Register this device
Recommended: generate a Curve25519 key pair on the device, keep the private key in secure storage, and send only `public_key`. Omit `public_key` to have IconicVPN generate the keys (they are then returned by /connect). Errors: 403 `account_blocked`, 409 `device_limit_reached` / `no_active_subscription` / `public_key_in_use`, 400 `invalid_name` / `invalid_public_key`.
Request body
| Field | Type | Description |
|---|---|---|
| name * | string | e.g. "My iPhone" |
| public_key | string | Base64 WireGuard public key generated on the device |
Responses
GET /api/app/v1/devices/{id} bearer token
Get a device
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| id | path | integer |
Responses
DELETE /api/app/v1/devices/{id} bearer token
Remove a device
The device is disconnected from every server within about 30 seconds and its slot is freed.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| id | path | integer |
Responses
Connect
Tunnel settings for the best server, with bandwidth-aware failover.
POST /api/app/v1/devices/{id}/connect bearer token
Get tunnel settings for the best server
Call every time the user connects, so failover applies. Choose by `location_id` (recommended), by `server_id`, or send neither for the best location overall.
Within a location, servers are tried in priority order and any server over its bandwidth limit is skipped in favour of the next. `alternatives` lists other servers in the location to try if the handshake fails.
A device can be added to a server up to ~30 seconds after it was created (servers sync every 30s). If the first handshake fails right after registering, retry briefly.
Errors: 403 `account_blocked`, 404 `not_found`, 409 `location_not_available` / `server_not_available` / `location_offline` / `no_servers`.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| id | path | integer |
Request body
| Field | Type | Description |
|---|---|---|
| location_id | string | e.g. "gb-london" |
| server_id | integer |
Responses
Billing
Buying a plan, plan billing, invoices, payments, cancellation and account history.
GET /api/app/v1/billing bearer token
Current plan billing
Payment method, renewal (or end) date, amount, and whether a cancellation is pending. `manage_url` is a one-tap sign-in link to Plan & billing in the client area.
Responses
- 200 BillingOverview
- 401 Error
POST /api/app/v1/billing/checkout-link bearer token
Link to buy (or renew) a plan
Returns a one-tap sign-in link to the website checkout for `plan_id` (a plan from GET /plans), where the customer picks how to pay (card, PayPal, Apple Pay, Google Pay or crypto). Open it in the browser straight away: it works once and expires after 10 minutes. With `renew: true` (prepaid crypto plans) it opens the renewal page instead and `plan_id` is ignored. 409 `already_subscribed` when the customer already has a paid plan; 404 `not_found` for a plan that isn’t on sale. After paying, GET /me shows the new subscription (usually within seconds; crypto can take longer).
Request body
| Field | Type | Description |
|---|---|---|
| plan_id | integer | |
| renew | boolean |
Responses
GET /api/app/v1/billing/invoices bearer token
Invoices for the VPN service, newest first
Responses
GET /api/app/v1/billing/invoices/{id}/pdf bearer token
Download an invoice as PDF
Redirects (302) to a short-lived PDF download, for invoices with `pdf_available` (Paddle payments). 404 `pdf_unavailable` for the others: show `view_url` instead.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| id | path | integer |
Responses
GET /api/app/v1/billing/payments bearer token
Payments and refunds, newest first
Responses
POST /api/app/v1/billing/cancellation bearer token
Cancel at the end of the billing period
Stops the plan renewing; the VPN keeps working until the end of the paid period (`next_due`). For crypto plans it stops the renewal reminders. 409 `not_cancellable` when there’s no active paid plan or it’s already cancelled; 503 `billing_unavailable` if the payment provider can’t be reached.
Request body
| Field | Type | Description |
|---|---|---|
| reason | string |
Responses
- 202 BillingOverview
- 401 Error
- 409 Error
- 429 Error
- 503 Error
POST /api/app/v1/billing/resume bearer token
Withdraw a pending cancellation
The plan carries on and renews as normal (crypto: the reminders come back). 409 `not_resumable` when there’s no pending cancellation; 503 `billing_unavailable` if the payment provider can’t be reached.
Responses
- 200 BillingOverview
- 401 Error
- 409 Error
- 429 Error
- 503 Error
POST /api/app/v1/billing/apple/transactions bearer token
Report an App Store purchase (iOS)
After a successful StoreKit 2 purchase (made with `appAccountToken` = `store_account_token` from GET /me), send its transaction id; also for “Restore purchases” (send each current entitlement’s `originalID`). The panel reads the transaction from Apple and links it to this account. Errors: 409 `purchase_belongs_to_another_account`, 404 `purchase_not_found`, 422 `product_not_sold` (no plan has that App Store product), 503 `store_not_configured`, 502 `store_unavailable` (retry later; finish the StoreKit transaction only after a 200).
Request body
| Field | Type | Description |
|---|---|---|
| transaction_id * | string | e.g. "2000000712345678" |
Responses
- 200
activated boolean The purchase gives access now (false for an expired purchase being restored, or a pending one) pending boolean Google Play: the payment isn’t complete yet (e.g. a cash payment). Check again later or wait for the plan to appear in GET /me. billing BillingOverview - 400 Error
- 401 Error
- 404 Error
- 409 Error
- 422 Error
- 429 Error
- 502 Error
- 503 Error
POST /api/app/v1/billing/google/purchases bearer token
Report a Google Play purchase (Android)
After Play Billing reports a purchased subscription (bought with `setObfuscatedAccountId(store_account_token)`), send its purchase token; also for restoring purchases. The panel reads it from Google, links it to this account and acknowledges it (the app doesn’t need to; unacknowledged purchases are refunded by Google after 3 days). Same errors as the App Store endpoint.
Request body
| Field | Type | Description |
|---|---|---|
| purchase_token * | string |
Responses
- 200
activated boolean The purchase gives access now (false for an expired purchase being restored, or a pending one) pending boolean Google Play: the payment isn’t complete yet (e.g. a cash payment). Check again later or wait for the plan to appear in GET /me. billing BillingOverview - 400 Error
- 401 Error
- 404 Error
- 409 Error
- 422 Error
- 429 Error
- 502 Error
- 503 Error
POST /api/app/v1/me/google-play/purchases bearer token
Start the plan for a Google Play subscription (Android, Play build)
After Play Billing reports a purchased subscription, and whenever the plan screen opens or the customer taps Restore purchase. Idempotent: send the same purchase as often as needed.
The panel reads the purchase from Google, checks it’s an active (or grace-period, or cancelled but not yet expired) subscription for `product_id`, and that it belongs to this account: its `obfuscatedAccountId` must be `sha256_hex("iconicvpn-customer:" + customer id)` (or this account’s `store_account_token`). A purchase without one (bought in an older app) is accepted if no other account has it. It then starts or updates the subscription (`trial` during Google’s free trial, otherwise `active`; `expires_at` is Google’s expiry time) and acknowledges the purchase. Returns the Account, as GET /me.
Errors: 400 `invalid_purchase` (wrong package, unknown or inactive purchase, or not for `product_id`), 409 `purchase_in_use` (it belongs to another account), 422 `unknown_product` (no plan sells that product and base plan), 503 `store_not_configured`, 502 `store_unavailable` (retry later).
Request body
| Field | Type | Description |
|---|---|---|
| package_name * | string | e.g. "com.vpn.iconicvpn" |
| product_id * | string | e.g. "iconicvpn_monthly" |
| purchase_token * | string |
Responses
GET /api/app/v1/history bearer token
Account history, newest first
Plan and status changes, devices added and removed, security events, invoices, payments and refunds.
Responses
- 200 array of HistoryEvent
- 401 Error
Data types
Error
Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.
| Field | Type | Description |
|---|---|---|
| error * | string | e.g. "device_limit_reached" |
| message * | string | e.g. "Device limit reached (5 of 5). Remove a device first or upgrade the plan." |
| fields | object | Per-field problems (validation errors on sign-up only) |
ClientInfo
Describes the app install. Shown to the customer in their list of signed-in apps.
| Field | Type | Description |
|---|---|---|
| name | string | e.g. "IconicVPN for iOS" |
| platform | string | `ios` from the iOS app. Accounts created with `ios` get no free trial from the server: the App Store subscription’s free trial applies instead. e.g. "ios" |
| app_version | string | e.g. "1.0.3" |
| device_model | string | e.g. "iPhone 15" |
TokenPair
| Field | Type | Description |
|---|---|---|
| token_type * | string: Bearer | |
| access_token * | string | Send as `Authorization: Bearer <access_token>`. Starts with `iva_`. |
| expires_in * | integer | Seconds until the access token expires e.g. 3600 |
| refresh_token * | string | Use once with POST /auth/refresh to get a new pair. Starts with `ivr_`. Store securely (Keychain/Keystore). |
| refresh_expires_in * | integer | Seconds until the refresh token expires if unused |
| session_id * | integer | This app session, as listed by GET /sessions |
OAuthTokenPair
Returned by POST /auth/oauth/token: a TokenPair plus `account_created`.
| Field | Type | Description |
|---|---|---|
| token_type * | string: Bearer | |
| access_token * | string | Send as `Authorization: Bearer <access_token>`. Starts with `iva_`. |
| expires_in * | integer | Seconds until the access token expires e.g. 3600 |
| refresh_token * | string | Use once with POST /auth/refresh to get a new pair. Starts with `ivr_`. Store securely (Keychain/Keystore). |
| refresh_expires_in * | integer | Seconds until the refresh token expires if unused |
| session_id * | integer | This app session, as listed by GET /sessions |
| account_created * | boolean | True when this Google/Apple sign-in created the account (with the server’s free trial, unless /start had `platform=ios`) |
PlanOffer
A plan on sale on the website (the pricing page). To buy it, get a link from POST /billing/checkout-link and open it in the browser.
| Field | Type | Description |
|---|---|---|
| id * | integer | |
| name * | string | e.g. "Yearly" |
| device_limit * | integer | e.g. 5 |
| price_cents * | integer | Price per billing interval e.g. 4999 |
| currency * | string | e.g. "GBP" |
| billing_interval * | string: month / quarter / year / biennial | |
| highlight | string | null | Short selling point, e.g. “Best value” e.g. "Best value" |
| apple_product_id | string | null | App Store subscription product id that sells this plan (iOS in-app purchase); null if not sold in the iOS app e.g. "com.iconicvpn.monthly" |
| google_product_id | string | null | Google Play subscription product id that sells this plan (Android in-app purchase); null if not sold in the Android app e.g. "iconicvpn_monthly" |
Customer
| Field | Type | Description |
|---|---|---|
| id * | integer | |
| name * | string | |
| email * | string (email) | |
| status * | string: lead / active / suspended / closed | |
| email_verified * | boolean |
Subscription
| Field | Type | Description |
|---|---|---|
| id | integer | |
| status | string: trial / active / past_due / suspended / cancelled / expired | `past_due`: a renewal payment hasn’t gone through yet (still connects for 7 days after the renewal date). `suspended`: still unpaid after that, devices can’t connect. |
| live | boolean | True for trial, active and past_due: devices can connect |
| started_at | string (date-time) | |
| expires_at | string (date-time) | null | End of the paid period (or trial): a card plan renews on this date, a cancelled or crypto plan ends on it |
| billed_externally | boolean | True when the plan was bought online and is billed through a payment method (`payment_method`). False for free trials and plans set up by our team. |
| payment_method | string | null | Null for free trials and plans set up by our team. Otherwise how the plan is paid (paddle, square, trust or nowpayments): Paddle, Square or Trust Payments (cards, renew automatically) or NOWPayments (crypto, prepaid: renewed by hand) e.g. "paddle" |
| cancel_at_period_end | boolean | Cancelled: ends at expires_at instead of renewing |
| billing_url | string | null | The client area’s Plan & billing page (needs the customer signed in; use POST /me/portal-link with page=billing) |
| auto_renew | boolean | |
| plan | object | |
| plan.id | integer | |
| plan.name | string | |
| plan.device_limit | integer | |
| plan.price_cents | integer | |
| plan.currency | string | e.g. "GBP" |
| plan.billing_interval | string: month / quarter / year / biennial |
Account
| Field | Type | Description |
|---|---|---|
| customer | Customer | |
| subscription | Subscription | object: | null | The current (or most recent) subscription; null if there has never been one |
| devices | object | |
| devices.used | integer | |
| devices.limit | integer | 0 when there is no live subscription |
| can_add_devices | boolean | |
| blocker | string | null | Why devices can’t be added or connected right now, if anything. An account that has never had a subscription (e.g. created in the iOS app, before its App Store purchase) gets “Choose a plan to start your free trial.” |
| verification_required | boolean | Whether an unverified email blocks devices on this service |
| store_account_token | string (uuid) | Pass with every in-app purchase: as `appAccountToken` (StoreKit 2, iOS) or `setObfuscatedAccountId` (Play Billing, Android). It ties the store purchase to this account, so it can’t be claimed by another one. Not secret, but there’s no need to show it. |
Session
| Field | Type | Description |
|---|---|---|
| id | integer | |
| current | boolean | True for the session making this request |
| client_name | string | null | |
| platform | string | null | |
| app_version | string | null | |
| device_model | string | null | |
| created_at | string (date-time) | |
| last_used_at | string (date-time) | |
| last_ip | string | null |
Location
| Field | Type | Description |
|---|---|---|
| id | string | Stable location id, e.g. `gb-london`. Pass to /connect. e.g. "gb-london" |
| name | string | e.g. "London, GB" |
| city | string | e.g. "London" |
| country_code | string | null | e.g. "GB" |
| servers | integer | Servers in this location available to the customer |
| available | boolean | At least one server here is online |
| busy | boolean | Every online server here is over its bandwidth limit (connections still work, but may be slower) |
| recommended_server_id | integer | null | The server /connect would pick right now |
Server
| Field | Type | Description |
|---|---|---|
| id | integer | |
| name | string | e.g. "uk-lon-01" |
| location_id | string | e.g. "gb-london" |
| location_name | string | e.g. "London, GB" |
| country_code | string | null | |
| online | boolean | |
| busy | boolean | Over its bandwidth limit; /connect prefers other servers in the location |
| load_percent | integer | null | Connected clients as a % of capacity |
| bandwidth_mbps | number | null | Recent average throughput (busier direction) |
| recommended | boolean | The server /connect would pick in this location right now |
Device
| Field | Type | Description |
|---|---|---|
| id | integer | |
| name | string | e.g. "My iPhone" |
| address | string | Tunnel IPv4 address assigned to this device e.g. "10.8.0.12" |
| public_key | string | The device’s WireGuard public key |
| key_location | string: device / server | `device`: the app generated the key pair and keeps the private key. `server`: the key was generated by IconicVPN and /connect returns it. |
| created_via | string: admin / portal / app | |
| created_at | string (date-time) |
Connection
Everything needed to bring up the WireGuard tunnel to the chosen server.
| Field | Type | Description |
|---|---|---|
| server | Server | |
| alternatives | array of Server | Other online servers in the same location, best first. Try these if the handshake with `server` fails. |
| interface | object | |
| interface.address | string | CIDR for the tunnel interface e.g. "10.8.0.12/32" |
| interface.dns | array of string | e.g. ["1.1.1.1","1.0.0.1"] |
| interface.private_key | string | null | Only for key_location=server devices. Null when the app holds the key. |
| peer | object | |
| peer.public_key | string | The server’s WireGuard public key |
| peer.preshared_key | string | Per-device preshared key (adds post-quantum resistance) |
| peer.endpoint | string | e.g. "81.31.231.115:51820" |
| peer.allowed_ips | array of string | e.g. ["0.0.0.0/0","::/0"] |
| peer.persistent_keepalive | integer | e.g. 25 |
| config | string | null | A complete wg-quick config file, only when the server holds the private key |
| site_routes | array of string | Internal site networks reachable through this server (site-to-site tunnels the customer’s plan allows). For a split tunnel that only reaches the sites, use these as allowed IPs instead of 0.0.0.0/0 and skip DNS. Empty when none. e.g. ["10.8.0.40/32","192.168.10.0/24"] |
BillingOverview
The current plan’s billing.
| Field | Type | Description |
|---|---|---|
| billed_externally | boolean | Bought online and billed through a payment method. False for free trials and plans set up by our team. |
| payment_method | string | null | paddle, square, trust or nowpayments; null when not paid through a payment method e.g. "paddle" |
| payment_method_label | string | null | e.g. "Paddle" |
| prepaid | boolean | Crypto: each payment buys one period and nothing renews automatically. Use POST /billing/checkout-link with renew=true before `next_due` to add another period. |
| payment_failed | boolean | The last renewal payment didn’t go through |
| can_resume | boolean | POST /billing/resume withdraws a pending cancellation |
| store_managed | boolean | Bought as an in-app purchase: change, cancel and refunds happen in the App Store or Google Play, not here (can_cancel is false). Open store_manage_url. |
| store_manage_url | string | null | The store’s subscription management page, for store_managed plans |
| plan_name | string | null | |
| status | string | null | Subscription status, as in Subscription.status |
| billing_cycle | string | null | e.g. "Yearly" |
| amount_cents | integer | null | Recurring charge per billing cycle |
| currency | string | null | e.g. "GBP" |
| next_due | string (date) | null | Next payment date (or the end date when a cancellation is pending) |
| cancellation_pending | boolean | |
| unpaid_invoices | integer | |
| unpaid_cents | integer | |
| manage_url | string | null | Open in a browser for the "Manage services" button: a one-tap sign-in link to the customer’s My VPN page in the client area (single use, valid 10 minutes; once it has expired it shows the login page, which then goes to My VPN). Plan changes, billing and cancellation are all reachable from there. For a fresh link at the moment of the tap, use POST /me/portal-link. |
| can_cancel | boolean | POST /billing/cancellation is available |
| synced_at | string (date-time) | null | Always null now that billing is in the panel (kept for older apps) |
Invoice
| Field | Type | Description |
|---|---|---|
| id | integer | |
| number | string | null | Invoice number, e.g. IV-1042 |
| reference | string | The payment provider’s id for the charge |
| status | string | paid or refunded (older imported invoices may show other statuses) e.g. "paid" |
| issued_on | string (date) | null | |
| due_on | string (date) | null | |
| paid_at | string (date-time) | null | |
| total_cents | integer | |
| tax_cents | integer | null | |
| currency | string | null | |
| items | array of object | |
| items[].description | string | |
| items[].amount_cents | integer | null | |
| items[].qty | number | |
| payable | boolean | Unpaid: open `pay_url` in a browser to pay it |
| pay_url | string | null | |
| pdf_available | boolean | GET /billing/invoices/{id}/pdf redirects to a PDF (Paddle payments) |
| view_url | string | The printable invoice in the client area (needs the customer signed in) |
Payment
| Field | Type | Description |
|---|---|---|
| id | integer | |
| amount_cents | integer | Negative for refunds |
| currency | string | null | |
| paid_at | string (date-time) | null | |
| method | string | null | Payment gateway |
| reference | string | null | |
| invoice_id | integer | null |
HistoryEvent
| Field | Type | Description |
|---|---|---|
| at | string (date-time) | |
| kind | string: account / plan / device / security / invoice / payment / refund | |
| text | string | e.g. "Plan changed from Monthly to 2 years" |
| amount_cents | integer | null | |
| currency | string | null | |
| invoice_id | integer | null |
* required field