POST /api/v3/images¶
Summary¶
POST /images
Description¶
Create a new image
Tags: creatives
Parameters¶
Header Parameters¶
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
Authorization |
string |
✓ Yes | Bearer {AuthToken} |
|
Content-Type |
string |
✓ Yes | multipart/form-data |
|
Accept |
string |
✓ Yes | application/json |
|
AppIdV3 |
string |
✓ Yes | LCUID-LAP-********-****-****-****-************ |
Request Body¶
Required: Yes
Content Type: multipart/form-data¶
Schema¶
Type: object
Required fields: file
Properties:
file(string) (required): Must be an image.
Example Implementations¶
Bash (cURL)¶
curl --request POST \
"https://api.lucit.app/api/v3/images" \
--header "Authorization: Bearer {AuthToken}" \
--header "Content-Type: multipart/form-data" \
--header "Accept: application/json" \
--header "AppIdV3: LCUID-LAP-********-****-****-****-************" \
--form "file=@/tmp/phpgvDmdO"
JavaScript (Fetch API)¶
const url = new URL(
"https://api.lucit.app/api/v3/images"
);
const headers = {
"Authorization": "Bearer {AuthToken}",
"Content-Type": "multipart/form-data",
"Accept": "application/json",
"AppIdV3": "LCUID-LAP-********-****-****-****-************",
};
const body = new FormData();
body.append('file', document.querySelector('input[name="file"]').files[0]);
fetch(url, {
method: "POST",
headers,
body,
}).then(response => response.json());
PHP (Guzzle)¶
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.lucit.app/api/v3/images',
[
'headers' => [
'Authorization' => 'Bearer {AuthToken}',
'Content-Type' => 'multipart/form-data',
'Accept' => 'application/json',
'AppIdV3' => 'LCUID-LAP-********-****-****-****-************',
],
'multipart' => [
[
'name' => 'file',
'contents' => fopen('/tmp/phpgvDmdO', 'r')
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Python (Requests)¶
import requests
import json
url = 'https://api.lucit.app/api/v3/images'
files = {
'file': open('/tmp/phpgvDmdO', 'rb')
}
headers = {
'Authorization': 'Bearer {AuthToken}',
'Content-Type': 'multipart/form-data',
'Accept': 'application/json',
'AppIdV3': 'LCUID-LAP-********-****-****-****-************'
}
response = requests.request('POST', url, headers=headers, files=files)
response.json()