WebSim.ai API Documentation

Welcome to the comprehensive API documentation for WebSim.ai. This guide covers both standard and special endpoints, as well as utility functions to enhance your WebSim experience.

Table of Contents

  1. Standard Endpoints
  2. Special Endpoints
  3. Utility Functions

1. Standard Endpoints

GET /api/last_site

Retrieves the most recently created website.

Response

[
  {
    "id": "string",
    "title": "string",
    "url": "string",
    "username": "string",
    "avatar_url": "string"
  }
]

POST /api/likes

Retrieves websites liked by a user.

Request Body

{
  "userid": "string"
}

Response

{
  "data": [
    {
      "site_id": "string",
      "title": "string",
      "simulated_url": "string",
      "username": "string",
      "avatar_url": "string",
      "liked_at": "string (ISO 8601 date)"
    }
  ]
}

GET /api/bookmarks

Retrieves new bookmarks.

Response

{
  "data": [
    {
      "site_id": "string",
      "title": "string",
      "simulated_url": "string",
      "username": "string",
      "avatar_url": "string"
    }
  ]
}

GET /api/trending

Retrieves trending websites.

Query Parameters

max_age_hours: number

Response

{
  "data": [
    {
      "site_id": "string",
      "title": "string",
      "simulated_url": "string",
      "username": "string",
      "avatar_url": "string",
      "likes": number,
      "views": number
    }
  ]
}

2. Special Endpoints

POST /api/svg_creator

Generates and returns a raw SVG element based on a given concept.

Request Body

{
  "concept": "string",
  "width": number,
  "height": number
}

Response

{
  "svg": "string (raw SVG content)"
}

POST /api/function_creator

Generates and returns JavaScript code for a described function that can be used directly in an eval statement.

Request Body

{
  "description": "string",
  "parameters": ["string"],
  "returnType": "string"
}

Response

{
  "function": "string (JavaScript function code)"
}

POST /api/create_site

Creates a new simulated website.

Request Body

{
  "title": "string",
  "url": "string",
  "content": "string (HTML content)"
}

Response

{
  "site_id": "string",
  "url": "string"
}

GET /api/random_site

Retrieves a random simulated website.

Response

{
  "site_id": "string",
  "title": "string",
  "url": "string",
  "content": "string (HTML content)"
}

3. Utility Functions

GET /api/color_scheme

Generates a cohesive color scheme based on a given base color.

Query Parameters

base_color: string (hex color code)

Response

{
  "primary": "string (hex color code)",
  "secondary": "string (hex color code)",
  "accent": "string (hex color code)",
  "background": "string (hex color code)",
  "text": "string (hex color code)"
}

POST /api/text_to_html

Converts plain text to formatted HTML.

Request Body

{
  "text": "string",
  "format": "string (optional: 'markdown' or 'basic')"
}

Response

{
  "html": "string (formatted HTML)"
}

GET /api/generate_lorem

Generates lorem ipsum placeholder text.

Query Parameters

paragraphs: number
words_per_paragraph: number (optional)

Response

{
  "text": "string (lorem ipsum text)"
}

POST /api/minify

Minifies HTML, CSS, or JavaScript code.

Request Body

{
  "code": "string",
  "type": "string ('html', 'css', or 'js')"
}

Response

{
  "minified": "string (minified code)"
}

This concludes the comprehensive API documentation for WebSim.ai. These endpoints and utility functions should provide you with powerful tools to create, manipulate, and enhance your simulated websites. Happy coding!