API Documentation

Welcome to the Y Converter API. You can use our API to access image conversion endpoints, which can help you convert images between formats like JPG, PNG, WEBP, AVIF, and more programmatically.

Base URL: https://converter.yahiaashraf.com/api/v1

Authentication

The API uses API keys to authenticate requests. You can view and manage your API keys in the Dashboard.

Authentication to the API is performed via the token parameter in the request body or query string.

POST

/convert

Convert an image from a URL to a specified target format.

Parameters

Name Type Required Description
token string Yes Your API key.
img_url string Yes The URL of the image to convert.
target_format string No Target format (jpg, png, webp, avif, etc). Default: webp.
quality integer No Image quality (1-100). Default: 80.

Example Request

curl -X POST https://converter.yahiaashraf.com/api/v1/convert \
  -d "token=YOUR_API_KEY" \
  -d "img_url=https://example.com/image.jpg" \
  -d "target_format=webp" \
  -d "quality=90"

Example Response

{
  "success": true,
  "data": {
    "url": "https://converter.yahiaashraf.com/storage/converted/image.webp",
    "format": "webp",
    "size": 12345,
    "width": 800,
    "height": 600
  }
}

Error Handling

The API uses standard HTTP status codes to indicate the success or failure of an API request.

  • 200 OK - Request successful.
  • 401 Unauthorized - Invalid or missing API key.
  • 422 Unprocessable Entity - Validation error (e.g. invalid URL or format).
  • 403 Forbidden - Monthly conversion quota exceeded.
  • 429 Too Many Requests - Rate limit exceeded.
  • 500 Internal Server Error - Server error during processing.