Intro
Start utilizing Picsart's Creative APIs efficiently with this simple guide, designed to enhance your applications with advanced editing features.
It only takes 3 minutes to create an account, get an API key, copy a sample code, and get images processed (e.g. backgrounds removed).
Picsart Creative APIs are based on a simple HTTP interface, and the output image is typically provided as a URL. Below you can find the sample codes to get started easily.
Sample Run
curl -X 'POST' \
'https://api.picsart.io/tools/1.0/removebg' \
-H 'accept: application/json' \
-H 'x-picsart-api-key: <API KEY HERE>' \
-H 'content-type: multipart/form-data' \
-F 'output_type=cutout' \
-F 'format=PNG' \
-F 'image_url=https://cdn140.picsart.com/13902645939997000779.jpg'
const FormData = require('form-data');
const http = require("https");
const form = new FormData();
const fs = require('fs');
form.append('bg_blur', '0');
form.append('scale', 'fit');
form.append('image_url', 'https://cdn140.picsart.com/03328718565819952445.jpeg');
form.append('bg_image_url', 'https://cdn140.picsart.com/22183977156062232333.png');
form.append('format', 'JPG');
form.append('output_type', 'cutout');
const options = {
"method": "POST",
"hostname": "api.picsart.io",
"port": null,
"path": "/tools/1.0/removebg",
"headers": {
"accept": "application/json",
"X-Picsart-API-Key": "YOURAPIKEYHERE",
...form.getHeaders()
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.on("error", (e) => {
console.error(e);
});
form.pipe(req);
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("multipart/form-data");
RequestBody body = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("bg_blur","0")
.addFormDataPart("scale","fit")
.addFormDataPart("image_url", "https://cdn140.picsart.com/03328718565819952445.jpeg")
.addFormDataPart("bg_image_url", "https://cdn140.picsart.com/22183977156062232333.png")
.addFormDataPart("format","JPG")
.addFormDataPart("output_type","cutout")
.build();
Request request = new Request.Builder()
.url("https://api.picsart.io/tools/1.0/removebg")
.method("POST", body)
.addHeader("accept", "application/json")
.addHeader("X-Picsart-API-Key", "YOURAPIKEYHERE")
.build();
Response response = client.newCall(request).execute();
import requests
url = "https://api.picsart.io/tools/1.0/removebg"
payload={
"bg_blur": "0",
"scale": "fit",
"image_url": "https://cdn140.picsart.com/03328718565819952445.jpeg",
"bg_image_url": "https://cdn140.picsart.com/22183977156062232333.png",
"format": "JPG",
"output_type": "cutout"}
files=[]
headers = {"accept": "application/json", "X-Picsart-API-Key": "YOURAPIKEY"}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
You need an API Key to interact with the Picsart Creative APIs.
You can learn more about how to get the key in the next section.
Discover our API documentation and explore examples to seamlessly integrate Programmable Image, Video and GenAI APIs into your applications or workflows.
Your first 200 API credits are on us (see Pricing). Log In to claim your credits.
Using the API Reference
As you already got your first application set up and the API Key is retrieved, let's now put that into the API Reference and try Picsart Creative APIs.
- Add the API Key in the Header input on the right side.
- Choose the API Product you want to try
- Check the parameters, details on how the service can be used
- Upload your image, specify the parameters
- On the right side, click on the Try It! button
- The service will be executed and you will soon get the response with the result image URL.
- On the right side you can also choose from a big range of programming languages and copy the code that will execute exactly the same service with exactly the same parameters. You just need to copy and paste the code and get started in your application.
Standards & Protocols
The base URL to send all API requests is https://api.picsart.io, https://genai-api.picsart.io or https://video-api.picsart.io, depending on the product you will be using. HTTPS is required for all API requests.
The Picsart Creative APIs follow RESTful conventions when possible, with most operations performed via GET, POST. Request and response bodies are encoded as application/x-www-form-urlencoded
.
It is also required for the client to handle application/json
responses. In particular, it's important to provide the accept: application/json
header as otherwise the request may not be processed and a 406
code will be returned (read more on this here).
Parameter conventions
- Image resources are addressable by a UUIDv4 "id" property.
- Property names are in
snake_case
(notcamelCase
orkebab-case
). - Temporal values (dates and datetimes) are encoded in ISO 8601 strings. Datetimes will include the time value (2020-08-12T02:12:33.231Z) while dates will include only the date (2020-08-12)
- Empty strings are not supported. To use the default value, simply don't send the parameter.
Parameter placement differs based on the endpoint:
GET requests: parameters are located within the query string.
POST requests: parameters are received through the request body.
Questions?
In this guide, we will demonstrate the steps to seamlessly incorporate our Programmable Creative APIs and Picsart Create Editor into your application. If you encounter any error messages or face other issues during the process, or if you have additional inquiries regarding the editor's functionality, we encourage you to consult our comprehensive Help Center. Our Help Center provides solutions to frequently asked questions and common errors that you may come across.
If you find that the Help Center does not address your specific concerns, please don't hesitate to reach out to us. Our team is dedicated to assisting you and will gladly provide the necessary support.
Updated 27 days ago