This page provides documentation for the various APIs available on Websim for accessing metadata related to projects, users, feeds, and more. Total Endpoints Documented: 0
These endpoints follow standard REST principles and can be accessed using HTTP requests (GET, POST, DELETE). Pagination parameters (`first`, `last`, `before`, `after`) are generally supported on list endpoints. Filtering, sorting, and other parameters may also be available as documented below or in the schema. The base URL for these endpoints is https://api.websim.com.
Get a project by id, including its latest revision and associated site (if posted).
Click "Test API" to see the response.
Get a project by username and slug.
Click "Test API" to see the response.
Get a paginated list of all public projects. Supports pagination, filtering (e.g., `posted`, `has_site`, `liked_by_owner`, `ids`, `min_version`, `query`) and sorting (`sort_by`).
Click "Test API" to see the response.
Get a paginated list of projects created by a specific user. The response includes projects of all visibility types (public, private, unlisted) for the authenticated user. Supports pagination, filtering (e.g., `posted`, `has_site`, `liked_by_owner`, `ids`, `min_version`, `query`) and sorting (`sort_by`).
Click "Test API" to see the response.
Get the latest projects from users followed by the specified user. Supports pagination and filtering (e.g., `posted`, `has_site`, `liked_by_owner`, `ids`, `min_version`, `query`) and sorting (`sort_by`).
Click "Test API" to see the response.
Get a paginated list of projects that remixed (are descendants of) a specific project. Supports pagination, filtering (e.g., `posted`, `has_site`, `liked_by_owner`, `ids`, `min_version`, `query`) and sorting (`sort_by`).
Click "Test API" to see the response.
Check if a project is currently featured.
Click "Test API" to see the response.
Get a paginated list of users who are banned from a specific project. Supports pagination (`first`, `last`, `before`, `after`) and optional filters.
Click "Test API" to see the response.
Get a specific revision for a project.
Click "Test API" to see the response.
Get a project revision by username and slug.
Click "Test API" to see the response.
Get a paginated list of all revisions for a specific project. Supports pagination.
Click "Test API" to see the response.
Get a paginated list of projects that remixed a specific revision of a project. Supports pagination, filtering (e.g., `posted`, `has_site`, `liked_by_owner`, `ids`, `min_version`, `query`) and sorting (`sort_by`).
Click "Test API" to see the response.
Get a list of all assets (images, audio, etc.) associated with a project revision.
Click "Test API" to see the response.
Get the raw content (file data) of a specific asset for a project revision.
Click "Test API" to see the response.
Get detailed usage statistics for a project, including daily views, referrers, playtime, top tippers, and total tips received.
Click "Test API" to see the response.
Get the permissions for a specific project, optionally for a given user (`user_id` query parameter).
Click "Test API" to see the response.
Get a list of all screenshots available for a project revision.
Click "Test API" to see the response.
Get details (including URL) for a specific screenshot of a project revision.
Click "Test API" to see the response.
Get the HTML content for a generated site. Useful for embedding or analysis. Supports query parameters like `__websim_origin` and `__websim_route`.
Click "Test API" to see the response.
Get the raw HTML content for a specific project revision. Supports query parameters like `__websim_origin` and `__websim_route`.
Click "Test API" to see the response.
Transform HTML content (e.g., for embedding or processing). Requires `__websim_origin` query parameter and `html`, `route` in the request body.
AI-powered endpoints for tasks like autosuggestion.
Provides AI-driven completions. This endpoint is not part of the public schema and may require specific parameters in the request body.
Suggests relevant packages based on a user's prompt. Requires `prompt` in the request body.
Get user details by username or id, including profile information.
Click "Test API" to see the response.
Search for users by a query string. Requires a `query` parameter.
Click "Test API" to see the response.
Update a user's profile information. Currently, only updating the description is supported. The user in the path must match the authenticated user.
// Request Body
{
"description": "My new awesome description"
}
Get user engagement statistics such as total likes received and total views on their projects.
Click "Test API" to see the response.
Get a paginated list of users that the specified user is following. Supports pagination and `count` parameter.
Click "Test API" to see the response.
Get a paginated list of users that are following the specified user. Supports pagination and `count` parameter.
Click "Test API" to see the response.
Follow a user.
Unfollow a user.
Get a paginated list of sites liked by a specific user.
Click "Test API" to see the response.
Check if a specific user has liked a specific project.
Click "Test API" to see the response.
Get the latest trending sites. Supports pagination (`offset`, `limit`) and filtering (`range`, `feed`, `for_user_id`, `is_multiplayer`).
Click "Test API" to see the response.
Get a feed of project posts. Supports pagination (`offset`, `limit`) and sorting (`sort` parameter: `for_you`, `following`, `latest`).
Click "Test API" to see the response.
Search the feed for projects/sites based on keywords (`search`) and sort criteria (`sort`). Supports pagination (`offset`, `limit`) and filtering (`range`, `feed`, `for_user_id`, `is_multiplayer`).
Click "Test API" to see the response.
Get the latest trending rooms by presence. Supports pagination (`limit`, `offset`).
Click "Test API" to see the response.
Endpoints dedicated to searching for assets and keywords.
Simple asset search. Supports `q` (query), `mime_type_prefix`, `limit`, and `offset` parameters.
Click "Test API" to see the response.
Performs multiple asset searches with the same filters in a single query. Requires `queries` array in the request body.
Smart asset search that uses AI to extract relevant search terms from a natural language query. Supports `q` (query), `limit`, and `offset`.
Click "Test API" to see the response.
Get related keywords for a search term using co-occurrence analysis. Supports `q` (query), `limit`, and `min_frequency`.
Click "Test API" to see the response.
Get top search queries from the most recent day. Supports `day`, `limit`, and `offset`.
Click "Test API" to see the response.
Metadata endpoints for accessing comment information.
Get a paginated list of comments for a project via REST API. Supports pagination (`first`, `last`, `before`, `after`) and sorting (`sort_by`, `sort_order`).
Click "Test API" to see the response.
Create a new comment for a project via REST API. Requires comment `content` and optional `parent_comment_id` in the request body.
Get a paginated list of replies to a specific comment via REST API. Supports pagination (`first`, `last`, `before`, `after`) and sorting (`sort_by`, `sort_order`).
Click "Test API" to see the response.
Add a reaction (like, emoji) to a specific comment via REST API. Requires `emoji` in the request body.
Remove a reaction from a specific comment via REST API. Requires `emoji` in the request body.
Endpoints for interacting with chat messages and reactions.
Add a reaction to a specific chat message. Requires `emoji` in the request body.
Remove a reaction from a specific chat message.
Endpoints for fetching activity feed events and submitting reports.
Get recent activity feed events (requires authentication).
Click "Test API" to see the response.
Submit a report for inappropriate content (comment or project). Requires `type` (comment or project), the corresponding `id`, and `reason` in the request body.
List of assets (images, audio, etc.) available in the current project's latest posted revision. Requires being inside a project context.
Loading assets...
These APIs are available directly in the browser environment via the Websim client or WebSocket connections for real-time interaction.
room.collection('review_v1'))Interact with project comments in real-time using the Websim WebSocket room collection. These operations are performed via the WebSocket connection, not directly via HTTP REST calls. Requires joining a project room first.
Create a new comment or reply in real-time via WebSocket. Requires comment `content` and optional `parentId`.
room.collection('review_v1').create({
content: {
type: 'document',
children: [{
type: 'paragraph',
children: [{ type: 'text', text: 'Your comment content here' }]
}]
},
parentId: null
}).then(newComment => {
console.log('Comment created:', newComment);
}).catch(error => {
console.error('Failed to create comment:', error);
});
Update an existing comment in real-time via WebSocket. Requires the comment `id` and updated `content`.
room.collection('review_v1').update(comment.id, {
content: {
type: 'document',
children: [{
type: 'paragraph',
children: [{ type: 'text', text: 'Updated comment content' }]
}]
}
}).then(() => {
console.log('Comment updated');
}).catch(error => {
console.error('Failed to update comment:', error);
});
Mark a comment as deleted in real-time via WebSocket. Requires the comment `id`.
room.collection('review_v1').delete(comment.id).then(() => {
console.log('Comment deleted');
}).catch(error => {
console.error('Failed to delete comment:', error);
});
Subscribe to real-time updates for the comments list via WebSocket. The callback receives the current list whenever it changes.
const unsubscribe = room.collection('review_v1').subscribe(commentList => {
console.log('Comments updated:', commentList);
});
Get the current list of comments available in the local cache from the WebSocket connection. This might not contain the full history unless subscribed or explicitly fetched.
const comments = room.collection('review_v1').getList();
console.log('Current comments from cache:', comments);
window.websim)Utility functions exposed globally on the Websim client window for client-side operations.
Retrieve details about the currently logged-in user client-side. Returns a User object or null if not logged in.
if (window.websim && typeof window.websim.getCurrentUser === 'function') {
window.websim.getCurrentUser().then(currentUser => {
console.log('Current User:', currentUser);
}).catch(error => {
console.error('Error fetching current user:', error);
});
} else {
console.log('`window.websim.getCurrentUser()` can only be run inside the Websim environment.');
}
Retrieve the user's preferences.
if (window.websim && typeof window.websim.getPreferences === 'function') {
window.websim.getPreferences().then(preferences => {
console.log('Preferences:', preferences);
}).catch(error => {
console.error('Error fetching preferences:', error);
});
} else {
console.log('`window.websim.getPreferences()` can only be run inside the Websim environment.');
}
Retrieve details about the creator associated with the current project or context. Returns a User object or null. Useful when building creator profile pages.
if (window.websim && typeof window.websim.getCreator === 'function') {
window.websim.getCreator().then(creator => {
console.log('Creator:', creator);
}).catch(error => {
console.error('Error fetching creator:', error);
});
} else {
console.log('`window.websim.getCreator()` can only be run inside the Websim environment.');
}
Retrieve details about the current project being viewed or interacted with. Returns a Project object or null.
if (window.websim && typeof window.websim.getCurrentProject === 'function') {
const currentProject = window.websim.getCurrentProject();
console.log('Current Project:', currentProject);
} else {
console.log('`window.websim.getCurrentProject()` can only be run inside the Websim environment.');
}
Update the description of the currently logged-in user. Requires the `description` in the payload.
if (window.websim && typeof window.websim.updateCurrentUser === 'function') {
window.websim.updateCurrentUser({
description: 'Your new description here.'
}).then(user => {
console.log('User description updated successfully:', user);
}).catch(error => {
console.error('Error updating user description:', error);
});
} else {
console.log('`window.websim.updateCurrentUser()` can only be run inside the Websim environment.');
}
You can test many of the GET API endpoints directly from your browser's developer console (usually F12). Open the console and paste the code examples below. Replace placeholder values like `{projectId}`, `{username}`, `{slug}` with actual values from the URL or project context.
Alternatively, use the "Test this endpoint" sections embedded within each REST GET endpoint description above.
Use the global `window.websim` function to get the logged-in user.
if (window.websim && typeof window.websim.getCurrentUser === 'function') {
window.websim.getCurrentUser().then(user => {
console.log('Current User:', user);
}).catch(error => {
console.error('Error fetching current user:', error);
});
} else {
console.log('`window.websim.getCurrentUser()` can only be run inside the Websim environment.');
}
Use the global `window.websim` function to get the details of the project you are currently viewing.
if (window.websim && typeof window.websim.getCurrentProject === 'function') {
const currentProject = window.websim.getCurrentProject();
console.log('Current Project:', currentProject);
} else {
console.log('`window.websim.getCurrentProject()` can only be run inside the Websim environment.');
}
Use the global `window.websim` function to update the description of the logged-in user. Change the text in the description field.
if (window.websim && typeof window.websim.updateCurrentUser === 'function') {
window.websim.updateCurrentUser({ description: 'Surfing the hallucinated web' })
.then(user => {
console.log('Successfully updated description for:', user.username);
console.log('New description:', user.description);
})
.catch(error => {
console.error('Error updating description:', error);
});
} else {
console.log('`window.websim.updateCurrentUser()` can only be run inside the Websim environment.');
}
Replace `YOUR_PROJECT_ID_HERE` with an actual project ID from a URL (e.g., after `/p/`).
const projectId = 'YOUR_PROJECT_ID_HERE';
fetch(`/api/v1/projects/${projectId}`)
.then(response => response.json())
.then(data => {
console.log('Project Data:', data);
})
.catch(error => {
console.error('Error fetching project:', error);
});
Replace `YOUR_USERNAME_HERE` with an actual Websim username (e.g., `username`).
const username = 'YOUR_USERNAME_HERE';
fetch(`/api/v1/users/${username}`)
.then(response => response.json())
.then(data => {
console.log('User Data:', data);
})
.catch(error => {
console.error('Error fetching user:', error);
});
Fetch the first 12 projects from the trending feed.
fetch('/api/v1/feed/trending?limit=12&offset=0&feed=hot')
.then(response => response.json())
.then(data => {
console.log('Trending Feed:', data);
})
.catch(error => {
console.error('Error fetching trending feed:', error);
});