Websim Metadata API Endpoints Documentation

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

REST API Endpoints

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.

Project Endpoints

Get Project by ID

GET /api/v1/projects/{id}

Get a project by id, including its latest revision and associated site (if posted).

Test this endpoint

Response:
Click "Test API" to see the response.

Get Project by Slug

GET /api/v1/users/{user}/slugs/{slug}

Get a project by username and slug.

Test this endpoint

Response:
Click "Test API" to see the response.

List All Public Projects

GET /api/v1/projects

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`).

Test this endpoint

Response:
Click "Test API" to see the response.

List User's Projects (Public, Private, Unlisted)

GET /api/v1/users/{user}/projects

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`).

Test this endpoint

Response:
Click "Test API" to see the response.

List Following Users' Projects

GET /api/v1/users/{user}/following/projects

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`).

Test this endpoint

Response:
Click "Test API" to see the response.

List Project Descendants

GET /api/v1/projects/{id}/descendants

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`).

Test this endpoint

Response:
Click "Test API" to see the response.

Check if Project is Featured

GET /api/v1/featured/{id}

Check if a project is currently featured.

Test this endpoint

Response:
Click "Test API" to see the response.

List Banned Users for Project

GET /api/v1/projects/{project-id}/banned-users

Get a paginated list of users who are banned from a specific project. Supports pagination (`first`, `last`, `before`, `after`) and optional filters.

Test this endpoint

Response:
Click "Test API" to see the response.

Project Revision Endpoints

Get Project Revision

GET /api/v1/projects/{id}/revisions/{version}

Get a specific revision for a project.

Test this endpoint

Response:
Click "Test API" to see the response.

Get Project Revision by Slug

GET /api/v1/users/{user}/slugs/{slug}/revisions/{version}

Get a project revision by username and slug.

Test this endpoint

Response:
Click "Test API" to see the response.

List Project Revisions

GET /api/v1/projects/{id}/revisions

Get a paginated list of all revisions for a specific project. Supports pagination.

Test this endpoint

Response:
Click "Test API" to see the response.

List Project Revision Descendants

GET /api/v1/projects/{id}/revisions/{version}/descendants

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`).

Test this endpoint

Response:
Click "Test API" to see the response.

Project Asset Endpoints

List Project Revision Assets

GET /api/v1/projects/{id}/revisions/{version}/assets

Get a list of all assets (images, audio, etc.) associated with a project revision.

Test this endpoint

Response:
Click "Test API" to see the response.

Get Project Revision Asset Content

GET /api/v1/projects/{id}/revisions/{version}/assets/{path}/content

Get the raw content (file data) of a specific asset for a project revision.

Test this endpoint

Response:
Click "Test API" to see the response.

Project Stats & Screenshot Endpoints

Get Project Detailed Stats

GET /api/v1/projects/{id}/stats

Get detailed usage statistics for a project, including daily views, referrers, playtime, top tippers, and total tips received.

Test this endpoint

Response:
Click "Test API" to see the response.

Get Project Permissions

GET /api/v1/projects/{id}/permissions

Get the permissions for a specific project, optionally for a given user (`user_id` query parameter).

Test this endpoint

Response:
Click "Test API" to see the response.

List Project Screenshots

GET /api/v1/projects/{id}/revisions/{version}/screenshots

Get a list of all screenshots available for a project revision.

Test this endpoint

Response:
Click "Test API" to see the response.

Get Project Screenshot

GET /api/v1/projects/{id}/revisions/{version}/screenshots/{screenshot_id}

Get details (including URL) for a specific screenshot of a project revision.

Test this endpoint

Response:
Click "Test API" to see the response.

HTML Endpoints

Get Site HTML Content

GET /api/v1/sites/{id}/html

Get the HTML content for a generated site. Useful for embedding or analysis. Supports query parameters like `__websim_origin` and `__websim_route`.

Test this endpoint

Response:
Click "Test API" to see the response.

Get Project Revision HTML Content

GET /api/v1/projects/{id}/revisions/{version}/html

Get the raw HTML content for a specific project revision. Supports query parameters like `__websim_origin` and `__websim_route`.

Test this endpoint

Response:
Click "Test API" to see the response.

Transform HTML Content

POST /api/v1/transform/html

Transform HTML content (e.g., for embedding or processing). Requires `__websim_origin` query parameter and `html`, `route` in the request body.

Inference Endpoints

AI-powered endpoints for tasks like autosuggestion.

AI Completion

POST /api/ai_completion

Provides AI-driven completions. This endpoint is not part of the public schema and may require specific parameters in the request body.

Prompt Autosuggest

POST /api/v1/inference/prompt_autosuggest

Suggests relevant packages based on a user's prompt. Requires `prompt` in the request body.

User Endpoints

Get User Details

GET /api/v1/users/{user}

Get user details by username or id, including profile information.

Test this endpoint

Response:
Click "Test API" to see the response.

Search for Users

GET /api/v1/user-search

Search for users by a query string. Requires a `query` parameter.

Test this endpoint

Response:
Click "Test API" to see the response.

Update User Description

PATCH /api/v1/users/{user}

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 Stats

GET /api/v1/users/{user}/stats

Get user engagement statistics such as total likes received and total views on their projects.

Test this endpoint

Response:
Click "Test API" to see the response.

Follow Endpoints

List User Following

GET /api/v1/users/{user}/following

Get a paginated list of users that the specified user is following. Supports pagination and `count` parameter.

Test this endpoint

Response:
Click "Test API" to see the response.

List User Followers

GET /api/v1/users/{user}/followers

Get a paginated list of users that are following the specified user. Supports pagination and `count` parameter.

Test this endpoint

Response:
Click "Test API" to see the response.

Follow User

POST /api/v1/users/{user}/follow

Follow a user.

Unfollow User

DELETE /api/v1/users/{user}/follow

Unfollow a user.

Like Endpoints

List User's Likes

GET /api/v1/users/{user}/likes

Get a paginated list of sites liked by a specific user.

Test this endpoint

Response:
Click "Test API" to see the response.

Check User's Project Like

GET /api/v1/users/{user}/project/{project_id}/like

Check if a specific user has liked a specific project.

Test this endpoint

Response:
Click "Test API" to see the response.

Get Trending Feed

GET /api/v1/feed/trending

Get the latest trending sites. Supports pagination (`offset`, `limit`) and filtering (`range`, `feed`, `for_user_id`, `is_multiplayer`).

Test this endpoint

Response:
Click "Test API" to see the response.

Get Project Posts Feed

GET /api/v1/feed/posts

Get a feed of project posts. Supports pagination (`offset`, `limit`) and sorting (`sort` parameter: `for_you`, `following`, `latest`).

Test this endpoint

Response:
Click "Test API" to see the response.

Get Search Feed

GET /api/v1/feed/search/{sort}/{search}

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`).

Test this endpoint

Response:
Click "Test API" to see the response.

Get Trending Rooms

GET /api/v1/feed/rooms

Get the latest trending rooms by presence. Supports pagination (`limit`, `offset`).

Test this endpoint

Response:
Click "Test API" to see the response.

Search Endpoints

Endpoints dedicated to searching for assets and keywords.

Simple Asset Search

GET /api/v1/search/assets

Simple asset search. Supports `q` (query), `mime_type_prefix`, `limit`, and `offset` parameters.

Test this endpoint

Response:
Click "Test API" to see the response.

Bulk Asset Search

POST /api/v1/search/assets/bulk

Performs multiple asset searches with the same filters in a single query. Requires `queries` array in the request body.

Relevant Asset Search (Smart Search)

GET /api/v1/search/assets/relevant

Smart asset search that uses AI to extract relevant search terms from a natural language query. Supports `q` (query), `limit`, and `offset`.

Test this endpoint

Response:
Click "Test API" to see the response.

Get Related Keywords

GET /api/v1/search/related

Get related keywords for a search term using co-occurrence analysis. Supports `q` (query), `limit`, and `min_frequency`.

Test this endpoint

Response:
Click "Test API" to see the response.

Get Top Searches

GET /api/v1/search/top

Get top search queries from the most recent day. Supports `day`, `limit`, and `offset`.

Test this endpoint

Response:
Click "Test API" to see the response.

Comment Endpoints (REST)

Metadata endpoints for accessing comment information.

List Project Comments

GET /api/v1/projects/{id}/comments

Get a paginated list of comments for a project via REST API. Supports pagination (`first`, `last`, `before`, `after`) and sorting (`sort_by`, `sort_order`).

Test this endpoint

Response:
Click "Test API" to see the response.

Create Project Comment

POST /api/v1/projects/{id}/comments

Create a new comment for a project via REST API. Requires comment `content` and optional `parent_comment_id` in the request body.

List Comment Replies

GET /api/v1/projects/{id}/comments/{comment_id}/replies

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`).

Test this endpoint

Response:
Click "Test API" to see the response.

Create Comment Reaction

POST /api/v1/projects/{id}/comments/{comment_id}/reactions

Add a reaction (like, emoji) to a specific comment via REST API. Requires `emoji` in the request body.

Delete Comment Reaction

DELETE /api/v1/projects/{id}/comments/{comment_id}/reactions

Remove a reaction from a specific comment via REST API. Requires `emoji` in the request body.

Chat Endpoints

Endpoints for interacting with chat messages and reactions.

Create Chat Message Reaction

POST /api/v1/messages/{message_id}/reactions

Add a reaction to a specific chat message. Requires `emoji` in the request body.

Delete Chat Message Reaction

DELETE /api/v1/messages/{message_id}/reactions/{emoji}

Remove a reaction from a specific chat message.

Activity & Report Endpoints

Endpoints for fetching activity feed events and submitting reports.

Activity Feed

GET /api/v1/activity-feed

Get recent activity feed events (requires authentication).

Test this endpoint

Response:
Click "Test API" to see the response.

Create Report

POST /api/v1/reports

Submit a report for inappropriate content (comment or project). Requires `type` (comment or project), the corresponding `id`, and `reason` in the request body.

Project Asset Library

List of assets (images, audio, etc.) available in the current project's latest posted revision. Requires being inside a project context.

Loading assets...

Client-Side & Realtime APIs

These APIs are available directly in the browser environment via the Websim client or WebSocket connections for real-time interaction.

WebSocket Comment API (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 Comment or Reply (Realtime)

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 a Comment (Realtime)

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);
});

Delete a Comment (Realtime)

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 Comments List (Realtime)

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 All Comments (Realtime Cache)

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);

Global Websim Functions (window.websim)

Utility functions exposed globally on the Websim client window for client-side operations.

Get Current User

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.');
}

Get Preferences

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.');
}

Get Creator

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.');
}

Get Current Project

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 Current User's Description

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.');
}

API Testing Examples

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.

Test: Get Current User (Client-side)

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.');
}

Test: Get Current Project (Client-side)

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.');
}

Test: Set User Description (Client-side)

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.');
}

Test: Fetch Project by ID (REST API)

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);
  });

Test: Fetch User by Username (REST API)

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);
  });

Test: Fetch Trending Feed (REST API)

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);
  });