GET /wp-json/rembg/v1/credits
Returns the number of credits available for the current user.
Example Response:
{ "isLoggedIn": true, "credits": 5 }
cURL Example:
curl -X GET \ "https://rembg.barchin.com/wp-json/rembg/v1/credits" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
POST /wp-json/rembg/v1/process-image
Processes an image to remove its background.
Parameters:
image
- Image file (JPEG or PNG)Success Response:
{ "image": "base64_encoded_image_data", "credits_remaining": 4, "isLoggedIn": true }
Error Response (Insufficient Credits):
{ "code": "insufficient_credits", "message": "Insufficient credits. Please purchase additional credits.", "data": { "status": 402 } }
cURL Example:
curl -X POST \ "https://rembg.barchin.com/wp-json/rembg/v1/process-image" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -F "image=@/path/to/your/image.jpg"
Note: When using JWT authentication, the credentials are passed in the Authorization header. The response contains the processed image in base64 format, which can be decoded and saved to a file.
Each image processing request consumes one credit from your account balance. Non-authenticated requests will have a watermark added to the processed image.