README.md

June 3, 2026 ยท View on GitHub

MyInstants

MyInstants REST API

PHP Version Deployed on Vercel License MIT PRs Welcome

A RESTful API for scraping and retrieving sound data from the MyInstants website. This API provides endpoints for retrieving information about sounds, including titles, URLs, descriptions, tags, favorites, views, and uploader details.

โœจ Features

  • โšก Ultra Fast: Powered by Vercel Edge Caching (s-maxage=3600) for ~0ms response times on cached requests.
  • ๐Ÿš€ Serverless Ready: Native deployment to Vercel without tweaking. Uses separate serverless functions for maximum efficiency.
  • ๐ŸŒ CORS Enabled: Ready to be consumed directly from frontend web applications (React, Vue, etc) without cross-origin issues.
  • ๐ŸŽฏ Reliable Error Handling: Returns proper HTTP status codes (e.g., 404, 400) instead of just 200 OK.

Table of Contents

๐Ÿš€ Getting Started

Requirements

  • PHP 7.4 or higher
  • simple_html_dom.php library for HTML parsing
  • curl extension enabled in php.ini

Installation

  1. Clone the repository to your server:

    git clone https://github.com/abdipr/myinstants-api.git
    cd myinstants-api
    
  2. Download and include simple_html_dom.php in the project directory.

  3. Local Development (No Apache/Nginx required): You can run the API locally using PHP's built-in web server. This project includes a router.php file that perfectly simulates Vercel's serverless routing environment, allowing you to access endpoints without the .php extension.

    php -S localhost:8000 router.php
    

    Now you can access the API locally (e.g., http://localhost:8000/best?q=id).

  4. Deploy to Vercel: Deploying is simple. Click the button below to deploy this repository directly to your Vercel account.
    Deploy with Vercel

โ‡๏ธ Reference

Endpoints

Base URL: https://myinstants-api.vercel.app

RequestResponseParameter
GET /trendingTrending based regionq
GET /searchSearch a soundq
GET /detailThe sound detailsid
GET /recentRecently uploaded sounds
GET /bestBest of all time soundsq
GET /uploadedUser's uploaded soundsusername
GET /favoritesUser's favorite soundsusername

Request Parameters

ParameterDescription
qSearch query or region
usernameUser's username
idSound's Unique ID

Response Example

A typical successful response (HTTP 200) will return a JSON object like this:

{
  "status": 200,
  "author": "abdipr",
  "data": [
    {
      "id": "vine-boom-sound-70972",
      "title": "VINE BOOM SOUND",
      "url": "https://www.myinstants.com/en/instant/vine-boom-sound-70972/",
      "mp3": "https://www.myinstants.com/media/sounds/vine-boom.mp3"
    }
  ]
}

Note: For the /detail endpoint, the data object will contain extra fields like description, tags, favorites, views, and uploader.

๐Ÿ’ฅ Error Handling

All errors return JSON objects with an appropriate HTTP status code (e.g., 404, 400) and a message explaining the issue.

  • 404 Error:
    • When the page is not found or an invalid endpoint is accessed.
    {
      "status": 404,
      "author": "abdipr",
      "message": "Endpoint not found"
    }
    

๐ŸŒ Examples

GET https://myinstants-api.vercel.app/trending?q=id

Example 2: Search Sounds by Query

GET https://myinstants-api.vercel.app/search?q=laugh

Example 3: Get Sound Details by ID

GET https://myinstants-api.vercel.app/detail?id=akh-26815

Example 4: Get Recently Uploaded Sounds

GET https://myinstants-api.vercel.app/recent

Example 5: Get Best of All Time Sounds

Retrieve a list of the most popular sounds of all time based on a specified region:

GET https://myinstants-api.vercel.app/best?q=id

Example 6: Get User's Uploaded Sounds

GET https://myinstants-api.vercel.app/uploaded?username=hellmouz

Example 7: Get User's Favorite Sounds

GET https://myinstants-api.vercel.app/favorites?username=hellmouz

๐ŸŒฑ Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature-name.
  3. Commit your changes: git commit -m 'Add feature'.
  4. Push to the branch: git push origin feature-name.
  5. Submit a pull request.

โœจ Support

If you like this project, please star on this repository, thank you โญ
You can support me by:
Trakteer Saya Buy Me A Coffee

โš–๏ธ License

This project is licensed under the MIT License. See the LICENSE file for more information.

โš ๏ธ Disclaimer

The sounds contained in this API are obtained from the original MyInstants website by web scraping. Developers using this API must follow the applicable regulations by mentioning this project or the official owner in their projects and are prohibited from abusing this API for personal benefits.

โฌ†๏ธ Back to Top