API Documentation

XApp provides REST API endpoints for managing posts and authentication.

Auth API

Login

GET/api/auth/twitter

Initiates the OAuth flow with X (Twitter).

Callback

GET/api/auth/twitter/callback

Handles the OAuth callback from X.

Query Parameters

code: The authorization code from X.
state: The CSRF protection state.

Response

Redirects to the homepage with a session cookie.

Get User

GET/api/auth/me

Fetches the current user's information.

Logout

POST/api/auth/logout

Logs out the user and clears the session.

Posts API

Get Posts

GET/api/posts

Fetches a list of collected posts.

Query Parameters

limit: Number of posts to return (default: 50).
offset: The starting position for pagination (default: 0).
collection: Filter by collection ID.
search: Search within post content.

Collections API

Search Collection

POST/api/collections/search

Starts a collection of posts based on a search query.

User Collection

POST/api/collections/user

Starts a collection of posts from a specific user.

Get Collections

GET/api/collections

Fetches a list of all collections.

Query Parameters

status: Filter by status (pending, in_progress, completed, failed).
limit: Number of collections (default: 50).
offset: The starting position for pagination.

Get Collection Progress

GET/api/collections/:id/progress

Fetches the progress of a specific collection.

Delete Collection

DELETE/api/collections/:id

Deletes a collection and all its associated posts.