Crop.photo
  1. Crop.photo API
Crop.photo
  • Crop.photo API
    • Introduction
    • Authentication
    • FAQs
    • Examples
    • Interactive API Testing
    • Auto Resize & Align
      POST
    • Body Aware Crop
      POST
    • Unrecognizable Crop
      POST
    • Remove Background
      POST
    • Create Banner Job
      POST
    • AI Lifestyle Crop
      POST
    • Banners Job Status
      POST
  1. Crop.photo API

Create Banner Job

Developing
POST
/banners/with-mask/create
Create banners from input mask and image.

Request

Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Body Params multipart/form-data
input_image
file 
required
Input image file.
mask_image
file 
required
PNG mask image with transparent pixels.
input_image_url
string <url>
optional
Input image URL. Note: either input_image or input_imaeg_url can be given at the same time.
mask_image_url
string 
optional
PNG mask image URL. Note: either mask_image_url or mask_image can be given at the same time.
minimum_margins
string 
required
Pixels (px): This is the most common unit. A value like 8px sets a fixed margin of 8 pixels on all sides of the element (top, right, bottom, and left). This margin size remains constant regardless of the element's dimensions or the size of the viewport (the visible area of the browser window).
Percentages (%): This unit defines the margin as a percentage of the element's size (width or height, depending on the side). For example, 8% sets a margin that is 8% of the element's width on the left and right sides, and 8% of its height on the top and bottom sides. This allows the margin to scale proportionally as the element's size changes, maintaining a consistent relative spacing.
Default:
5%
Example:
5%
ai_model
enum<string> 
optional
Choose the customized AI model or let us decide
Allowed value:
auto
Default:
auto
Example:
auto
analysis_hints
array[string]
optional
Enhance the AI model's precision by supplying up to five hints or pieces of additional information. These hints serve as valuable guidance, allowing the AI to more accurately pinpoint and concentrate on the relevant subject matter. By acting as clues, they assist the AI in refining its analysis, leading to outcomes of greater accuracy and detail.
Example:
["cars","parts","person","auto parts"]
job_labels
array[string]
required
Allocate specific labels to this job. These assigned labels will be included in the job's response, enabling you to efficiently search and retrieve jobs based on these labels. It's possible for multiple jobs to share a common label, facilitating the organization and querying of jobs that are related or fall under a similar category.
Example:
["car-model-lot-1","honda-lot-x"]
webhook
string <uri>
optional
Optional webhook to be notified when a job either completes successfully or fails. The webhook should be capable of handling POST requests and accepting data in the application/json format. For successful communication, the webhook must return an HTTP Status 200 response. If it doesn't, the system will attempt to resend the notification three more times, with each attempt spaced approximately 30 minutes apart, before it considers the webhook notification as failed.
Example:
https://my-server.com/callback
webhook_secret
string 
optional
When provided, the webhook will be invoked with a specific secret value included in the X-WEBHOOK-SECRET request header. Utilize this secret to authenticate and validate the incoming callback request, ensuring it's from a trusted source.
response_type
enum<string> 
optional
Allowed values:
urlcrop-info
Default:
crop-info

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://us1-api.crop.photo/v1/banners/with-mask/create' \
--form 'input_image=@""' \
--form 'mask_image=@""' \
--form 'input_image_url=""' \
--form 'mask_image_url=""' \
--form 'minimum_margins="5%"' \
--form 'ai_model="auto"' \
--form 'analysis_hints="cars"' \
--form 'analysis_hints="parts"' \
--form 'analysis_hints="person"' \
--form 'analysis_hints="auto parts"' \
--form 'job_labels="car-model-lot-1"' \
--form 'job_labels="honda-lot-x"' \
--form 'webhook=""' \
--form 'webhook_secret=""' \
--form 'response_type=""'

Responses

🟢200Success
application/json
Body
job_id
string 
required
Assigned Job ID to the request.
Example
{
  "job_id": "string"
}
🟠401Unauthorized
🟠400Invalid Input | Crop.photo
Modified at 2024-04-26 16:06:39
Previous
Remove Background
Next
AI Lifestyle Crop
Built with