{"openapi":"3.0.3","info":{"title":"IconicVPN App API","version":"1.0.0","description":"REST API for IconicVPN’s own apps: accounts, locations, devices and WireGuard connection settings."},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Access token (`iva_…`) from /auth/login, /auth/signup, /auth/oauth/token or /auth/refresh"}},"schemas":{"Error":{"type":"object","description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","properties":{"error":{"type":"string","example":"device_limit_reached"},"message":{"type":"string","example":"Device limit reached (5 of 5). Remove a device first or upgrade the plan."},"fields":{"type":"object","additionalProperties":{"type":"string"},"description":"Per-field problems (validation errors on sign-up only)"}},"required":["error","message"]},"ClientInfo":{"type":"object","description":"Describes the app install. Shown to the customer in their list of signed-in apps.","properties":{"name":{"type":"string","maxLength":80,"example":"IconicVPN for iOS"},"platform":{"type":"string","maxLength":40,"example":"ios","description":"`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."},"app_version":{"type":"string","maxLength":40,"example":"1.0.3"},"device_model":{"type":"string","maxLength":80,"example":"iPhone 15"}}},"TokenPair":{"type":"object","properties":{"token_type":{"type":"string","enum":["Bearer"]},"access_token":{"type":"string","description":"Send as `Authorization: Bearer <access_token>`. Starts with `iva_`."},"expires_in":{"type":"integer","description":"Seconds until the access token expires","example":3600},"refresh_token":{"type":"string","description":"Use once with POST /auth/refresh to get a new pair. Starts with `ivr_`. Store securely (Keychain/Keystore)."},"refresh_expires_in":{"type":"integer","description":"Seconds until the refresh token expires if unused"},"session_id":{"type":"integer","description":"This app session, as listed by GET /sessions"}},"required":["token_type","access_token","expires_in","refresh_token","refresh_expires_in","session_id"]},"OAuthTokenPair":{"type":"object","properties":{"token_type":{"type":"string","enum":["Bearer"]},"access_token":{"type":"string","description":"Send as `Authorization: Bearer <access_token>`. Starts with `iva_`."},"expires_in":{"type":"integer","description":"Seconds until the access token expires","example":3600},"refresh_token":{"type":"string","description":"Use once with POST /auth/refresh to get a new pair. Starts with `ivr_`. Store securely (Keychain/Keystore)."},"refresh_expires_in":{"type":"integer","description":"Seconds until the refresh token expires if unused"},"session_id":{"type":"integer","description":"This app session, as listed by GET /sessions"},"account_created":{"type":"boolean","description":"True when this Google/Apple sign-in created the account (with the server’s free trial, unless /start had `platform=ios`)"}},"required":["token_type","access_token","expires_in","refresh_token","refresh_expires_in","session_id","account_created"],"description":"Returned by POST /auth/oauth/token: a TokenPair plus `account_created`."},"PlanOffer":{"type":"object","description":"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.","properties":{"id":{"type":"integer"},"name":{"type":"string","example":"Yearly"},"device_limit":{"type":"integer","example":5},"price_cents":{"type":"integer","description":"Price per billing interval","example":4999},"currency":{"type":"string","example":"GBP"},"billing_interval":{"type":"string","enum":["month","quarter","year","biennial"]},"highlight":{"type":"string","nullable":true,"description":"Short selling point, e.g. “Best value”","example":"Best value"},"apple_product_id":{"type":"string","nullable":true,"description":"App Store subscription product id that sells this plan (iOS in-app purchase); null if not sold in the iOS app","example":"com.iconicvpn.monthly"},"google_product_id":{"type":"string","nullable":true,"description":"Google Play subscription product id that sells this plan (Android in-app purchase); null if not sold in the Android app","example":"iconicvpn_monthly"}},"required":["id","name","device_limit","price_cents","currency","billing_interval"]},"Customer":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"email":{"type":"string","format":"email"},"status":{"type":"string","enum":["lead","active","suspended","closed"]},"email_verified":{"type":"boolean"}},"required":["id","name","email","status","email_verified"]},"Subscription":{"type":"object","properties":{"id":{"type":"integer"},"status":{"type":"string","enum":["trial","active","past_due","suspended","cancelled","expired"],"description":"`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":{"type":"boolean","description":"True for trial, active and past_due: devices can connect"},"started_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time","nullable":true,"description":"End of the paid period (or trial): a card plan renews on this date, a cancelled or crypto plan ends on it"},"billed_externally":{"type":"boolean","description":"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":{"type":"string","nullable":true,"example":"paddle","description":"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)"},"cancel_at_period_end":{"type":"boolean","description":"Cancelled: ends at expires_at instead of renewing"},"billing_url":{"type":"string","nullable":true,"description":"The client area’s Plan & billing page (needs the customer signed in; use POST /me/portal-link with page=billing)"},"auto_renew":{"type":"boolean"},"plan":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"device_limit":{"type":"integer"},"price_cents":{"type":"integer"},"currency":{"type":"string","example":"GBP"},"billing_interval":{"type":"string","enum":["month","quarter","year","biennial"]}}}}},"Account":{"type":"object","properties":{"customer":{"$ref":"#/components/schemas/Customer"},"subscription":{"anyOf":[{"$ref":"#/components/schemas/Subscription"},{"type":"object","nullable":true,"enum":[null]}],"description":"The current (or most recent) subscription; null if there has never been one"},"devices":{"type":"object","properties":{"used":{"type":"integer"},"limit":{"type":"integer","description":"0 when there is no live subscription"}}},"can_add_devices":{"type":"boolean"},"blocker":{"type":"string","nullable":true,"description":"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":{"type":"boolean","description":"Whether an unverified email blocks devices on this service"},"store_account_token":{"type":"string","format":"uuid","description":"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":{"type":"object","properties":{"id":{"type":"integer"},"current":{"type":"boolean","description":"True for the session making this request"},"client_name":{"type":"string","nullable":true},"platform":{"type":"string","nullable":true},"app_version":{"type":"string","nullable":true},"device_model":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"last_used_at":{"type":"string","format":"date-time"},"last_ip":{"type":"string","nullable":true}}},"Location":{"type":"object","properties":{"id":{"type":"string","description":"Stable location id, e.g. `gb-london`. Pass to /connect.","example":"gb-london"},"name":{"type":"string","example":"London, GB"},"city":{"type":"string","example":"London"},"country_code":{"type":"string","nullable":true,"example":"GB"},"servers":{"type":"integer","description":"Servers in this location available to the customer"},"available":{"type":"boolean","description":"At least one server here is online"},"busy":{"type":"boolean","description":"Every online server here is over its bandwidth limit (connections still work, but may be slower)"},"recommended_server_id":{"type":"integer","nullable":true,"description":"The server /connect would pick right now"}}},"Server":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string","example":"uk-lon-01"},"location_id":{"type":"string","example":"gb-london"},"location_name":{"type":"string","example":"London, GB"},"country_code":{"type":"string","nullable":true},"online":{"type":"boolean"},"busy":{"type":"boolean","description":"Over its bandwidth limit; /connect prefers other servers in the location"},"load_percent":{"type":"integer","nullable":true,"description":"Connected clients as a % of capacity"},"bandwidth_mbps":{"type":"number","nullable":true,"description":"Recent average throughput (busier direction)"},"recommended":{"type":"boolean","description":"The server /connect would pick in this location right now"}}},"Device":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string","example":"My iPhone"},"address":{"type":"string","description":"Tunnel IPv4 address assigned to this device","example":"10.8.0.12"},"public_key":{"type":"string","description":"The device’s WireGuard public key"},"key_location":{"type":"string","enum":["device","server"],"description":"`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":{"type":"string","enum":["admin","portal","app"]},"created_at":{"type":"string","format":"date-time"}}},"Connection":{"type":"object","description":"Everything needed to bring up the WireGuard tunnel to the chosen server.","properties":{"server":{"$ref":"#/components/schemas/Server"},"alternatives":{"type":"array","items":{"$ref":"#/components/schemas/Server"},"description":"Other online servers in the same location, best first. Try these if the handshake with `server` fails."},"interface":{"type":"object","properties":{"address":{"type":"string","description":"CIDR for the tunnel interface","example":"10.8.0.12/32"},"dns":{"type":"array","items":{"type":"string"},"example":["1.1.1.1","1.0.0.1"]},"private_key":{"type":"string","nullable":true,"description":"Only for key_location=server devices. Null when the app holds the key."}}},"peer":{"type":"object","properties":{"public_key":{"type":"string","description":"The server’s WireGuard public key"},"preshared_key":{"type":"string","description":"Per-device preshared key (adds post-quantum resistance)"},"endpoint":{"type":"string","example":"81.31.231.115:51820"},"allowed_ips":{"type":"array","items":{"type":"string"},"example":["0.0.0.0/0","::/0"]},"persistent_keepalive":{"type":"integer","example":25}}},"config":{"type":"string","nullable":true,"description":"A complete wg-quick config file, only when the server holds the private key"},"site_routes":{"type":"array","items":{"type":"string"},"example":["10.8.0.40/32","192.168.10.0/24"],"description":"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."}}},"BillingOverview":{"type":"object","description":"The current plan’s billing.","properties":{"billed_externally":{"type":"boolean","description":"Bought online and billed through a payment method. False for free trials and plans set up by our team."},"payment_method":{"type":"string","nullable":true,"example":"paddle","description":"paddle, square, trust or nowpayments; null when not paid through a payment method"},"payment_method_label":{"type":"string","nullable":true,"example":"Paddle"},"prepaid":{"type":"boolean","description":"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":{"type":"boolean","description":"The last renewal payment didn’t go through"},"can_resume":{"type":"boolean","description":"POST /billing/resume withdraws a pending cancellation"},"store_managed":{"type":"boolean","description":"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":{"type":"string","nullable":true,"description":"The store’s subscription management page, for store_managed plans"},"plan_name":{"type":"string","nullable":true},"status":{"type":"string","nullable":true,"description":"Subscription status, as in Subscription.status"},"billing_cycle":{"type":"string","nullable":true,"example":"Yearly"},"amount_cents":{"type":"integer","nullable":true,"description":"Recurring charge per billing cycle"},"currency":{"type":"string","nullable":true,"example":"GBP"},"next_due":{"type":"string","format":"date","nullable":true,"description":"Next payment date (or the end date when a cancellation is pending)"},"cancellation_pending":{"type":"boolean"},"unpaid_invoices":{"type":"integer"},"unpaid_cents":{"type":"integer"},"manage_url":{"type":"string","nullable":true,"description":"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":{"type":"boolean","description":"POST /billing/cancellation is available"},"synced_at":{"type":"string","format":"date-time","nullable":true,"description":"Always null now that billing is in the panel (kept for older apps)"}}},"Invoice":{"type":"object","properties":{"id":{"type":"integer"},"number":{"type":"string","nullable":true,"description":"Invoice number, e.g. IV-1042"},"reference":{"type":"string","description":"The payment provider’s id for the charge"},"status":{"type":"string","example":"paid","description":"paid or refunded (older imported invoices may show other statuses)"},"issued_on":{"type":"string","format":"date","nullable":true},"due_on":{"type":"string","format":"date","nullable":true},"paid_at":{"type":"string","format":"date-time","nullable":true},"total_cents":{"type":"integer"},"tax_cents":{"type":"integer","nullable":true},"currency":{"type":"string","nullable":true},"items":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string"},"amount_cents":{"type":"integer","nullable":true},"qty":{"type":"number"}}}},"payable":{"type":"boolean","description":"Unpaid: open `pay_url` in a browser to pay it"},"pay_url":{"type":"string","nullable":true},"pdf_available":{"type":"boolean","description":"GET /billing/invoices/{id}/pdf redirects to a PDF (Paddle payments)"},"view_url":{"type":"string","description":"The printable invoice in the client area (needs the customer signed in)"}}},"Payment":{"type":"object","properties":{"id":{"type":"integer"},"amount_cents":{"type":"integer","description":"Negative for refunds"},"currency":{"type":"string","nullable":true},"paid_at":{"type":"string","format":"date-time","nullable":true},"method":{"type":"string","nullable":true,"description":"Payment gateway"},"reference":{"type":"string","nullable":true},"invoice_id":{"type":"integer","nullable":true}}},"HistoryEvent":{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"kind":{"type":"string","enum":["account","plan","device","security","invoice","payment","refund"]},"text":{"type":"string","example":"Plan changed from Monthly to 2 years"},"amount_cents":{"type":"integer","nullable":true},"currency":{"type":"string","nullable":true},"invoice_id":{"type":"integer","nullable":true}}}}},"paths":{"/api/app/v1/status":{"get":{"summary":"Service status","tags":["Meta"],"description":"Public. Use to check connectivity and whether sign-up is open before showing a sign-up screen.","responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","example":"1.0.0"},"server_time":{"type":"string","format":"date-time"},"signup_open":{"type":"boolean"},"trial_days":{"type":"integer","nullable":true}}}}}}}}},"/api/app/v1/updates/{platform}":{"get":{"summary":"Latest app version for a platform","tags":["Meta"],"description":"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":[{"schema":{"type":"string","enum":["windows","android","ios","macos"]},"in":"path","name":"platform","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"platform":{"type":"string","enum":["windows","android","ios","macos"]},"latest_version":{"type":"string","example":"0.2.0","description":"Dotted numbers: major.minor.patch, optionally a fourth part"},"minimum_version":{"type":"string","nullable":true,"example":"0.1.0","description":"Installed versions below this must update"},"download_url":{"type":"string","example":"https://dev.iconicvpn.com/downloads/IconicVPN-Setup-0.2.0.exe","description":"Open in the user’s browser"},"release_notes":{"type":"string","nullable":true,"description":"Plain text, a sentence or two"},"published_at":{"type":"string","format":"date-time"}},"required":["platform","latest_version","minimum_version","download_url","release_notes","published_at"]}}}},"400":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/plans":{"get":{"summary":"Plans on sale","tags":["Meta"],"description":"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":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PlanOffer"}}}}}}}},"/api/app/v1/auth/signup":{"post":{"summary":"Create an account (starts the free trial)","tags":["Authentication"],"description":"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.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","email","password"],"properties":{"name":{"type":"string","maxLength":120},"email":{"type":"string","maxLength":200},"password":{"type":"string","minLength":10,"maxLength":200},"client":{"$ref":"#/components/schemas/ClientInfo"},"start_trial":{"type":"boolean","default":true,"description":"`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":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"tokens":{"$ref":"#/components/schemas/TokenPair"},"account":{"$ref":"#/components/schemas/Account"}}}}}},"403":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/auth/login":{"post":{"summary":"Sign in with email and password","tags":["Authentication"],"description":"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.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string","maxLength":200},"password":{"type":"string","maxLength":200},"client":{"$ref":"#/components/schemas/ClientInfo"}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenPair"}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/auth/refresh":{"post":{"summary":"Exchange a refresh token for a new token pair","tags":["Authentication"],"description":"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.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["refresh_token"],"properties":{"refresh_token":{"type":"string","maxLength":100},"client":{"$ref":"#/components/schemas/ClientInfo"}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenPair"}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/auth/forgot-password":{"post":{"summary":"Email a password reset link","tags":["Authentication"],"description":"Always returns 202, whether or not the email has an account. The link opens the web portal.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","maxLength":200}}}}}},"responses":{"202":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/auth/providers":{"get":{"summary":"Sign-in providers available","tags":["Authentication"],"description":"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":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"google":{"type":"boolean"},"apple":{"type":"boolean"}},"required":["google","apple"]}}}}}}},"/api/app/v1/auth/oauth/{provider}/start":{"get":{"summary":"Start Google or Apple sign-in (open in the browser)","tags":["Authentication"],"description":"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.\n\nAn 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.\n\nThe 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":[{"schema":{"type":"string","maxLength":500,"example":"http://127.0.0.1:53817/callback"},"in":"query","name":"redirect_uri","required":true,"description":"Loopback URL the app listens on: `http://127.0.0.1:<port>/<path>`, `http://[::1]:<port>/<path>` or `http://localhost:<port>/<path>`"},{"schema":{"type":"string","minLength":16,"maxLength":200},"in":"query","name":"state","required":true,"description":"Random value from the app, returned unchanged. Check it on the way back."},{"schema":{"type":"string","minLength":43,"maxLength":43},"in":"query","name":"code_challenge","required":true,"description":"Base64url (no padding) SHA-256 of the app’s code_verifier"},{"schema":{"type":"string","enum":["S256"]},"in":"query","name":"code_challenge_method","required":true},{"schema":{"type":"string","maxLength":40,"example":"ios"},"in":"query","name":"platform","required":false,"description":"Optional. `ios` from the iOS app: a new account gets no server free trial (it starts with the App Store purchase)."},{"schema":{"type":"string","enum":["google","apple"]},"in":"path","name":"provider","required":true}],"responses":{"302":{"description":"To the provider’s sign-in page, or back to `redirect_uri` with `error`"},"400":{"description":"Error page (bad `redirect_uri` or `state`)"}}}},"/api/app/v1/auth/oauth/google/callback":{"get":{"summary":"Google sign-in return (called by Google)","tags":["Authentication"],"description":"Register this URL in the Google OAuth client’s “Authorised redirect URIs”. Apps never call it.","responses":{"302":{"description":"Back to the app’s `redirect_uri`"}}}},"/api/app/v1/auth/oauth/apple/callback":{"post":{"summary":"Apple sign-in return (form post from Apple)","tags":["Authentication"],"description":"Register this URL as a “Return URL” on the Apple Services ID. Apps never call it.","responses":{"302":{"description":"Back to the app’s `redirect_uri`"}}}},"/api/app/v1/auth/oauth/token":{"post":{"summary":"Swap a Google/Apple sign-in code for tokens","tags":["Authentication"],"description":"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.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["code","code_verifier","redirect_uri"],"properties":{"code":{"type":"string","maxLength":100},"code_verifier":{"type":"string","minLength":43,"maxLength":128,"description":"The secret whose SHA-256 was sent as code_challenge"},"redirect_uri":{"type":"string","maxLength":500,"example":"http://127.0.0.1:53817/callback"},"client":{"$ref":"#/components/schemas/ClientInfo"}}}}}},"responses":{"200":{"description":"Returned by POST /auth/oauth/token: a TokenPair plus `account_created`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthTokenPair"}}}},"400":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/auth/google":{"post":{"summary":"Sign in with a Google ID token","tags":["Authentication"],"description":"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.\n\nDoesn’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`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id_token"],"properties":{"id_token":{"type":"string","maxLength":4096,"description":"Google ID token (JWT) whose audience is IconicVPN’s Google Web client ID"},"client":{"$ref":"#/components/schemas/ClientInfo"}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenPair"}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/auth/google/signup":{"post":{"summary":"Create an account from a Google ID token (starts the free trial)","tags":["Authentication"],"description":"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).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id_token"],"properties":{"id_token":{"type":"string","maxLength":4096,"description":"Google ID token (JWT) whose audience is IconicVPN’s Google Web client ID"},"client":{"$ref":"#/components/schemas/ClientInfo"},"start_trial":{"type":"boolean","default":true,"description":"`false` from the Google Play build: the account starts with no subscription, because the free trial comes with the Google Play subscription"}}}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenPair"}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/auth/logout":{"post":{"summary":"Sign this app out","tags":["Authentication"],"description":"Revokes the current session’s tokens.","security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response"},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/me":{"get":{"summary":"Account, subscription and device allowance","tags":["Account"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"summary":"Update profile","tags":["Account"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":120}}}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"400":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/me/password":{"post":{"summary":"Change password","tags":["Account"],"description":"Signs out every other app session. This session stays signed in.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["current_password","new_password"],"properties":{"current_password":{"type":"string","maxLength":200},"new_password":{"type":"string","minLength":10,"maxLength":200}}}}}},"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response"},"400":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/me/resend-verification":{"post":{"summary":"Resend the email confirmation link","tags":["Account"],"security":[{"bearerAuth":[]}],"responses":{"202":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/me/portal-link":{"post":{"summary":"One-tap sign-in link to the client area","tags":["Account"],"description":"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.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"page":{"type":"string","enum":["my_vpn","account","delete_account","billing","renew"],"default":"my_vpn"}}}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"expires_in":{"type":"integer","example":600}},"required":["url","expires_in"]}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/me/delete":{"post":{"summary":"Delete the account permanently","tags":["Account"],"description":"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.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"confirm":{"type":"string","maxLength":20,"example":"DELETE"}},"required":["confirm"]}}}},"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response"},"400":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/sessions":{"get":{"summary":"List signed-in app sessions","tags":["Account"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Session"}}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/sessions/{id}":{"delete":{"summary":"Sign out an app session","tags":["Account"],"description":"Use to sign out a lost device. Revoking the current session works like /auth/logout.","parameters":[{"schema":{"type":"integer"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response"},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/billing":{"get":{"summary":"Current plan billing","tags":["Billing"],"description":"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.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The current plan’s billing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingOverview"}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/billing/checkout-link":{"post":{"summary":"Link to buy (or renew) a plan","tags":["Billing"],"description":"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).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"plan_id":{"type":"integer"},"renew":{"type":"boolean","default":false}}}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"expires_in":{"type":"integer","example":600}},"required":["url","expires_in"]}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/billing/invoices":{"get":{"summary":"Invoices for the VPN service, newest first","tags":["Billing"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Invoice"}}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/billing/invoices/{id}/pdf":{"get":{"summary":"Download an invoice as PDF","tags":["Billing"],"description":"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":[{"schema":{"type":"integer"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/billing/payments":{"get":{"summary":"Payments and refunds, newest first","tags":["Billing"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Payment"}}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/billing/cancellation":{"post":{"summary":"Cancel at the end of the billing period","tags":["Billing"],"description":"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.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":500}}}}}},"security":[{"bearerAuth":[]}],"responses":{"202":{"description":"The current plan’s billing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingOverview"}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/billing/resume":{"post":{"summary":"Withdraw a pending cancellation","tags":["Billing"],"description":"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.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The current plan’s billing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingOverview"}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/billing/apple/transactions":{"post":{"summary":"Report an App Store purchase (iOS)","tags":["Billing"],"description":"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).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["transaction_id"],"properties":{"transaction_id":{"type":"string","maxLength":30,"example":"2000000712345678"}}}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"activated":{"type":"boolean","description":"The purchase gives access now (false for an expired purchase being restored, or a pending one)"},"pending":{"type":"boolean","description":"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":{"$ref":"#/components/schemas/BillingOverview"}},"required":["activated","pending","billing"]}}}},"400":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/billing/google/purchases":{"post":{"summary":"Report a Google Play purchase (Android)","tags":["Billing"],"description":"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.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["purchase_token"],"properties":{"purchase_token":{"type":"string","maxLength":1000}}}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"activated":{"type":"boolean","description":"The purchase gives access now (false for an expired purchase being restored, or a pending one)"},"pending":{"type":"boolean","description":"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":{"$ref":"#/components/schemas/BillingOverview"}},"required":["activated","pending","billing"]}}}},"400":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/me/google-play/purchases":{"post":{"summary":"Start the plan for a Google Play subscription (Android, Play build)","tags":["Billing"],"description":"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.\n\nThe 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.\n\nErrors: 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).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["package_name","product_id","purchase_token"],"properties":{"package_name":{"type":"string","maxLength":200,"example":"com.vpn.iconicvpn"},"product_id":{"type":"string","maxLength":100,"example":"iconicvpn_monthly"},"purchase_token":{"type":"string","maxLength":1000}}}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"400":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/history":{"get":{"summary":"Account history, newest first","tags":["Billing"],"description":"Plan and status changes, devices added and removed, security events, invoices, payments and refunds.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/HistoryEvent"}}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/locations":{"get":{"summary":"Locations available on the customer’s plan","tags":["Servers"],"description":"Show these in the location picker. Available locations come first.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Location"}}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/servers":{"get":{"summary":"Individual servers with live load","tags":["Servers"],"description":"For advanced pickers. Most apps only need /locations plus /connect.","parameters":[{"schema":{"type":"string","maxLength":80},"in":"query","name":"location_id","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Server"}}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/devices":{"get":{"summary":"List devices","tags":["Devices"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Device"}}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Register this device","tags":["Devices"],"description":"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`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":40,"example":"My iPhone"},"public_key":{"type":"string","minLength":44,"maxLength":44,"description":"Base64 WireGuard public key generated on the device"}}}}}},"security":[{"bearerAuth":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Device"}}}},"400":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/devices/{id}":{"get":{"summary":"Get a device","tags":["Devices"],"parameters":[{"schema":{"type":"integer"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Device"}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"summary":"Remove a device","tags":["Devices"],"description":"The device is disconnected from every server within about 30 seconds and its slot is freed.","parameters":[{"schema":{"type":"integer"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response"},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/app/v1/devices/{id}/connect":{"post":{"summary":"Get tunnel settings for the best server","tags":["Connect"],"description":"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.\n\nWithin 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.\n\nA 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.\n\nErrors: 403 `account_blocked`, 404 `not_found`, 409 `location_not_available` / `server_not_available` / `location_offline` / `no_servers`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"location_id":{"type":"string","maxLength":80,"example":"gb-london"},"server_id":{"type":"integer"}}}}}},"parameters":[{"schema":{"type":"integer"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Everything needed to bring up the WireGuard tunnel to the chosen server.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Connection"}}}},"401":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Every error response has this shape. `error` is a stable machine-readable code; `message` is human-readable and may change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"servers":[{"url":"https://iconicvpn.com","description":"This environment"}],"tags":[{"name":"Meta","description":"Service information and app updates. No authentication."},{"name":"Authentication","description":"Sign up, sign in (email and password, Google or Apple) and keep the app signed in with rotating refresh tokens."},{"name":"Account","description":"The signed-in customer, their subscription and app sessions."},{"name":"Servers","description":"Locations and servers available on the customer’s plan, with live load."},{"name":"Devices","description":"WireGuard devices (peers) on the account. Each app install should register one device."},{"name":"Connect","description":"Tunnel settings for the best server, with bandwidth-aware failover."},{"name":"Billing","description":"Buying a plan, plan billing, invoices, payments, cancellation and account history."}]}