POST Media
POST /brands/{brandId}/mediaUploads a media file (image or video) and returns an id you can reference when creating a post.
Path parameters
Section titled “Path parameters”| Parameter | Type | Description |
|---|---|---|
brandId | integer | ID from the brands list. |
Request body:
multipart/form-data with a single field:
| Field | Type | Description |
|---|---|---|
media | file | The image or video to upload. |
Request
Section titled “Request”curl -X POST https://nuelink.com/api/public/v1/brands/13493/media \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "media=@./photo.jpg"const formData = new FormData();formData.append('media', fileInput.files[0]);
const response = await fetch('https://nuelink.com/api/public/v1/brands/13493/media', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', }, body: formData,});
const data = await response.json();console.log(data);<?php
$ch = curl_init('https://nuelink.com/api/public/v1/brands/13493/media');
curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_POSTFIELDS => [ 'media' => new CURLFile('./photo.jpg'), ], CURLOPT_HTTPHEADER => [ 'Authorization: Bearer YOUR_API_KEY', ], CURLOPT_RETURNTRANSFER => true,]);
$response = curl_exec($ch);curl_close($ch);
echo $response;Response: 201 Created
{ "status": "success", "data": { "id": "bWVkaWEvcmo2dzRhSVY4YUJOMWJoU3c4U2t6VEJOenVXcjRoTmsuanBn", "type": "image/jpeg", "size": 4587311 }}Response fields
Section titled “Response fields”| Field | Type | Description |
|---|---|---|
id | string | Opaque media ID. Pass this as media[].id when posting. |
type | string | MIME type detected by the server. |
size | integer | File size in bytes. |
Supported file types and size limits
Section titled “Supported file types and size limits”| Type | Accepted formats | Max size |
|---|---|---|
Image | PNG, JPG / JPEG | 100 MB |
Video | MP4, MOV | 100 MB |
Document | PDF (used for LinkedIn document posts) | 100 MB |
Nuelink accepts a single file per upload and returns a media id you can reference in POST /posts.
Error Examples
Section titled “Error Examples”Error example: no file sent:
Response: 422 Unprocessable Entity
{ "status": "error", "message": "The given data was invalid.", "errors": { "media": [ "The media field is required." ] }}Error example: file too large:
Response: 422 Unprocessable Entity
{ "status": "error", "message": "The given data was invalid.", "errors": { "media": [ "The media file may not be greater than 100 megabytes." ] }}Error example: unsupported format:
Response: 422 Unprocessable Entity:
{ "status": "error", "message": "The given data was invalid.", "errors": { "media": [ "The media must be a file of type: png, jpg, jpeg, mp4, mov, pdf." ] }}Supported uploads (max 100 MB each):
- Images: png, jpg, jpeg
- Videos: mp4, mov
- Documents: pdf
Example validation errors:
{ "status": "error", "message": "The given data was invalid.", "errors": { "media": ["The media field is required."] }}{ "status": "error", "message": "The given data was invalid.", "errors": { "media": ["The media file may not be greater than 100 megabytes."] }}{ "status": "error", "message": "The given data was invalid.", "errors": { "media": ["The media must be a file of type: png, jpg, jpeg, mp4, mov, pdf."] }}