XenForo REST API for a mobile app: what your forum needs

A XenForo REST API mobile app reads your forum through the API XenForo has included since version 2.1: threads, posts, conversations, alerts and members, with XenForo’s permissions applied to every request. The app also needs per-member sign-in, push device registration and app settings, and your server has to let API traffic through firewalls and caches.
A WebView app asks your server for web pages. A native app asks for data and draws the screens itself, so everything it shows has to arrive through an API. That is why some features appear in a native app on day one and others need integration work.
Does XenForo have a REST API?
Yes. Every XenForo installation from version 2.1 onward includes a REST API under the forum’s /api/ path. It covers nodes, threads, posts, conversations, alerts, attachments and users, and each request runs through XenForo’s permission system. Requests carry a key in the XF-Api-Key header, and only super administrators can create keys.
Keys are managed in the admin control panel under Setup, Service providers, API keys. The API reference at docs.xenforo.com lists every endpoint, including the OAuth2 ones added in XenForo 2.3.
Which API key should a mobile app use?
None of XenForo’s three key types is meant for members’ phones. A guest key acts as a guest, a user key acts as one fixed account, and a super user key can act as any member through the XF-Api-User header. Anything compiled into an app can be extracted, so a super user key must stay on the server.
| Key type | Acts as | Inside an app download |
|---|---|---|
| Guest | Always a guest | Harmless, but members cannot post or see private forums |
| User | One fixed account | Every member would post as that one account |
| Super user | Any member chosen with XF-Api-User | Anyone who extracts it can act as any member |
How our app handles keys
In current XFMobile builds, the app carries only a public app key. It is not a secret: it marks a request as coming from the app, and on its own it gets guest access. A member’s identity comes from a session token issued when that member signs in, stored in the iPhone Keychain or, on Android, encrypted with a key held in the Android Keystore. The Suite add-on then calls the core API for that member on the server, where the super user key stays.
Can a mobile app post as the signed-in member using only the REST API?
Not on its own before XenForo 2.3. A user key posts as one fixed account, and a super user key is unsafe on a phone, so apps add a sign-in service on the server. XenForo 2.3 added a built-in OAuth2 server that issues a token for each member who approves the app, which gives a standard route for that part.
XenForo’s API reference lists /oauth2/token, /oauth2/introspect and /oauth2/revoke endpoints for that flow. Even with OAuth2, the core API leaves gaps for a full community app, covered in the next section.
What does a native app need beyond the core API?
The core API was built for integrations, not for a complete mobile product. A community app also needs member sign-in, a place to store each phone’s push token, app settings such as colours and navigation, and data for add-on features your members rely on. XFMobile Suite is a XenForo add-on that provides these next to the core API.
- Member sign-in. The member signs in once and the app receives a token that works only for that member.
- Push device registration. Each phone’s push token is stored against the member’s account so the forum knows where to send a notification. This is how the stored token is used for delivery.
- App configuration. Colours, layout, navigation and home shortcuts, which the app reads at start-up.
- Feature data. Endpoints for features that the core API does not cover.
Because Suite lives inside XenForo, the same administrators manage it from the same admin control panel, and it reads the same members and permissions as the forum.
How should you prepare the server before testing?
Most launch problems sit on the server, not in the app. Check five things: a valid HTTPS certificate on the exact domain the app uses, firewall and bot rules that let API and sign-in paths through, caches that never store signed-in API responses, upload limits that accept full-size phone photos, and email that actually reaches members.
- HTTPS everywhere. A valid certificate on the exact domain the app calls, including any www or non-www redirect.
- Firewall and bot protection. A JavaScript challenge page cannot be solved by a native app. Create a rule that lets API and sign-in paths through, or members will be blocked.
- Caching. Full-page caches and CDNs must not cache authenticated API responses. A cached response for one member could be served to another.
- Upload limits. Phones send large photos. Check PHP and web server upload limits as well as XenForo’s attachment settings.
- Email. Registration and password resets still send email. Confirm that it arrives and is not marked as spam.
Will third-party XenForo add-ons work in a native app?
Only if the app knows how to request their data. On the web, an add-on adds templates and pages; a native app cannot display arbitrary templates. Ask whether each add-on has its own API routes and whether the app supports them. List the add-ons members use every week, not everything installed, and send that list before ordering.
That short list is what any app vendor needs to give you a straight answer. You can send yours through our contact page, along with your XenForo version.
How do you test the API side before launch?
Use a normal member account, never an administrator. Administrators see everything, which hides permission problems. With a member in an ordinary user group, browse a forum, post a reply, upload a photo, open a private conversation and receive a notification. If those five journeys work, the API side of the launch is in good shape.
Frequently asked questions
Is the XenForo REST API free?
Yes. It is part of XenForo itself from version 2.1, with no separate licence or add-on. Super administrators create keys under Setup, Service providers, API keys in the admin control panel. The work for a mobile app lies elsewhere: per-member sign-in, push, app settings and the screens themselves.
Can a XenForo API request run without a key?
No. XenForo needs a key even for guest access; a guest key simply runs every request with guest permissions. XenForo recommends a separate key for each client, so you can revoke one integration without breaking the others, and scopes that limit each key to the parts of the API it needs.
What does api_bypass_permissions do?
With a super user key, setting api_bypass_permissions to 1 makes that request ignore the context member’s permissions. It exists for trusted server-side integrations such as imports or moderation tools. It is one more reason a super user key must never travel inside an app that members can download and inspect.
Which XenForo versions does XFMobile support?
XFMobile Suite requires XenForo 2.2 or later. The add-on provides its own member sign-in and push registration, so the app does not depend on the OAuth2 server added in 2.3. Send us your exact version and the add-ons your members use, and we confirm which workflows are covered.