Quick Start
Your first post in 5 steps
Section titled “Your first post in 5 steps”Each step below maps to an endpoint documented further down. Examples are available in cURL, JavaScript, and PHP.
1. Verify your token works
Section titled “1. Verify your token works”curl https://nuelink.com/api/public/v1/me \ -H "Authorization: Bearer YOUR_API_KEY"const response = await fetch('https://nuelink.com/api/public/v1/me', { headers: { Authorization: 'Bearer YOUR_API_KEY', },});
const data = await response.json();console.log(data);<?php
$ch = curl_init('https://nuelink.com/api/public/v1/me');
curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => [ 'Authorization: Bearer YOUR_API_KEY', ], CURLOPT_RETURNTRANSFER => true,]);
$response = curl_exec($ch);curl_close($ch);
echo $response;2. List your brands and pick one
Section titled “2. List your brands and pick one”curl https://nuelink.com/api/public/v1/brands \ -H "Authorization: Bearer YOUR_API_KEY"const response = await fetch('https://nuelink.com/api/public/v1/brands', { headers: { Authorization: 'Bearer YOUR_API_KEY', },});
const data = await response.json();console.log(data);<?php
$ch = curl_init('https://nuelink.com/api/public/v1/brands');
curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => [ 'Authorization: Bearer YOUR_API_KEY', ], CURLOPT_RETURNTRANSFER => true,]);
$response = curl_exec($ch);curl_close($ch);
echo $response;Grab the id of the brand you want to post from. We’ll call it BRAND_ID.
3. List collections in that brand
Section titled “3. List collections in that brand”curl https://nuelink.com/api/public/v1/brands/BRAND_ID/collections \ -H "Authorization: Bearer YOUR_API_KEY"const response = await fetch( 'https://nuelink.com/api/public/v1/brands/BRAND_ID/collections', { headers: { Authorization: 'Bearer YOUR_API_KEY', }, });
const data = await response.json();console.log(data);<?php
$ch = curl_init('https://nuelink.com/api/public/v1/brands/BRAND_ID/collections');
curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => [ 'Authorization: Bearer YOUR_API_KEY', ], CURLOPT_RETURNTRANSFER => true,]);
$response = curl_exec($ch);curl_close($ch);
echo $response;Pick the collection whose channels you want to publish to. We’ll call it COLLECTION_ID.
4. (Optional) Upload a media file
Section titled “4. (Optional) Upload a media file”Skip this step if your post is text-only.
curl -X POST https://nuelink.com/api/public/v1/brands/BRAND_ID/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/BRAND_ID/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/BRAND_ID/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;Save the returned id.
5. Create the post
Section titled “5. Create the post”curl -X POST https://nuelink.com/api/public/v1/brands/BRAND_ID/collections/COLLECTION_ID/posts \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "caption": "Hello from the Nuelink API 👋", "publishMode": "IMMEDIATE", "media": [{ "id": "MEDIA_ID_FROM_STEP_4" }] }'const payload = { caption: 'Hello from the Nuelink API 👋', publishMode: 'IMMEDIATE', media: [{ id: 'MEDIA_ID_FROM_STEP_4' }],};
const response = await fetch( 'https://nuelink.com/api/public/v1/brands/BRAND_ID/collections/COLLECTION_ID/posts', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify(payload), });
const data = await response.json();console.log(data);<?php
$payload = [ 'caption' => 'Hello from the Nuelink API 👋', 'publishMode' => 'IMMEDIATE', 'media' => [ ['id' => 'MEDIA_ID_FROM_STEP_4'], ],];
$ch = curl_init('https://nuelink.com/api/public/v1/brands/BRAND_ID/collections/COLLECTION_ID/posts');
curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode($payload), CURLOPT_HTTPHEADER => [ 'Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json', ], CURLOPT_RETURNTRANSFER => true,]);
$response = curl_exec($ch);curl_close($ch);
echo $response;You’ll get back a post ID and the post will be pushed to every channel in the collection.