1# A. Create an ordinary post for review.
2curl --location 'https://api.nonli.com/v2.1/posts/bulk' \
3 --header 'Content-Type: application/json' \
4 --header 'Authorization: Bearer YOUR_API_TOKEN' \
5 --data '{
6 "post": [{
7 "brandId": 1,
8 "postType": "text",
9 "message": "Hello from the Nonli API",
10 "status": "review",
11 "socialAccount": {
12 "externalId": "SOCIAL_ACCOUNT_ACCOUNT_ID",
13 "type": "facebook"
14 }
15 }]
16 }'
17
18# B. Build a three-segment thread.
19# 1. Create the root with the shortlink mapping.
20curl --location 'https://api.nonli.com/v2.1/posts/bulk' \
21 --header 'Content-Type: application/json' \
22 --header 'Authorization: Bearer YOUR_API_TOKEN' \
23 --data '{
24 "post": [
25 {
26 "brandId": 1,
27 "postType": "text",
28 "message": "The opening segment",
29 "status": "review",
30 "shortlink": { "mappingId": "SHORTLINK_MAPPING_ID" },
31 "socialAccount": {
32 "externalId": "SOCIAL_ACCOUNT_ACCOUNT_ID",
33 "type": "threads"
34 },
35 "thread": { "activated": true }
36 }
37 ]
38 }'
39
40# Save the returned id as ROOT_POST_ID and its shortDomain/shortId values.
41# 2. Create the middle segment. The first child's parent is also the origin.
42curl --location 'https://api.nonli.com/v2.1/posts/bulk' \
43 --header 'Content-Type: application/json' \
44 --header 'Authorization: Bearer YOUR_API_TOKEN' \
45 --data '{
46 "post": [{
47 "brandId": 1,
48 "postType": "text",
49 "message": "The middle segment",
50 "status": "review",
51 "socialAccount": { "externalId": "SOCIAL_ACCOUNT_ACCOUNT_ID", "type": "threads" },
52 "thread": {
53 "activated": true,
54 "isChild": true,
55 "parent": "ROOT_POST_ID",
56 "origin": "ROOT_POST_ID"
57 }
58 }]
59 }'
60
61# Save the returned id as MIDDLE_POST_ID.
62# Verify that the root lists the first child before continuing.
63curl --location 'https://api.nonli.com/v2.1/posts?filters=id:ROOT_POST_ID&fields=id,thread' \
64 --header 'Authorization: Bearer YOUR_API_TOKEN'
65
66# 3. Create the final segment without the URL. Its parent is the middle segment.
67curl --location 'https://api.nonli.com/v2.1/posts/bulk' \
68 --header 'Content-Type: application/json' \
69 --header 'Authorization: Bearer YOUR_API_TOKEN' \
70 --data '{
71 "post": [{
72 "brandId": 1,
73 "postType": "text",
74 "message": "Read the complete story:",
75 "status": "review",
76 "socialAccount": { "externalId": "SOCIAL_ACCOUNT_ACCOUNT_ID", "type": "threads" },
77 "thread": {
78 "activated": true,
79 "isChild": true,
80 "parent": "MIDDLE_POST_ID",
81 "origin": "ROOT_POST_ID"
82 }
83 }]
84 }'
85
86# Save the returned id as FINAL_POST_ID and verify the complete child order.
87curl --location 'https://api.nonli.com/v2.1/posts?filters=id:ROOT_POST_ID&fields=id,thread' \
88 --header 'Authorization: Bearer YOUR_API_TOKEN'
89
90# Then add the resolved root URL to the final segment.
91curl --request PUT --location 'https://api.nonli.com/v2.1/posts/bulk' \
92 --header 'Content-Type: application/json' \
93 --header 'Authorization: Bearer YOUR_API_TOKEN' \
94 --data '{
95 "post": [{
96 "id": "FINAL_POST_ID",
97 "message": "Read the complete story: https://ROOT_SHORT_DOMAIN/ROOT_SHORT_ID"
98 }]
99 }'
100
101# 4. Read back the root and final segment. Verify the ordered root thread.children
102# list and the final resolved URL before publication. This GET returns the usual
103# paginated { "total": ..., "rows": [...] } search response.
104curl --location 'https://api.nonli.com/v2.1/posts?filtersOr=id:ROOT_POST_ID,FINAL_POST_ID&fields=id,author,userId,status,postType,message,shortDomain,shortId,thread' \
105 --header 'Authorization: Bearer YOUR_API_TOKEN'
6.Social accounts
10 endpointsRead connected social accounts and quota data required before creating or scheduling posts.
/social-accountsBearer obligatorio6.1.Search social accounts
Return social accounts available to the authenticated company and user.
Parámetros query
sizeint100pageint0sortstringfiltersstringfiltersOrstringexcludesstringfieldsstringembedstringCampos devueltos
totalintrowsSocialAccount[]idintaccountIdstringnamestringtypestringbrandIdintstatusstringEjemplo
/social-accounts/:socialAccountIdBearer obligatorio6.2.Get a social account
Return one connected social account with publishing metadata.
Parámetros query
fieldsstringCampos devueltos
idintaccountIdstringnamestringtypestringbrandIdintEjemplo
/social-accounts/publishing-quotaBearer obligatorio6.3.Get publishing quota
Return publishing quota information for selected social accounts before scheduling posts.
Parámetros query
socialAccountsstringCampos devueltos
totalintrowsobject[]externalIdstringtypestringquotaint|nullEjemplo
/social-accounts/youtube/playlistsBearer obligatorio6.4.Get YouTube playlists
Return the playlists of connected YouTube social accounts, to choose the `youtube.playlistIds` of a YouTube post. Playlist items (videos) are not returned.
playlistsarray and anerrormessage, and the other accounts are still returned.privacyStatus. They are cached for one hour per account. The cache is cleared after a create, update, or delete through this API; a change made in YouTube Studio appears after the cache expires or withforce=true. A playlist created moments ago can be missing from the list until YouTube exposes it: read the list again withforce=true.Parámetros query
socialAccounts*stringforceboolfalseCampos devueltos
YouTubeAccountPlaylists[]YouTubeAccountPlaylists[]socialAccountIdintplaylistsobject[]idstringtitlestringdescriptionstringthumbnailUrlstringitemCountintprivacyStatusstringerrorstringEjemplo
Ejemplo de respuesta
/social-accounts/youtube/playlistsBearer obligatorio6.5.Create a YouTube playlist
Create a playlist on the channel of a connected YouTube social account. The API answers 201 Created with the new playlist. The API-token role must be allowed to manage social accounts. An unknown socialAccountId, or one that is not a YouTube account, returns 404 Not Found.
itemCountand the playlist items endpoint returns an empty page.Parámetros body
socialAccountId*inttitle*stringdescriptionstringprivacyStatusstringprivateCampos devueltos
idstringtitlestringdescriptionstringthumbnailUrlstringitemCountintprivacyStatusstringEjemplo
Ejemplo de respuesta
/social-accounts/youtube/playlists/:playlistIdBearer obligatorio6.6.Update a YouTube playlist
Change the title, description, or visibility of a playlist of a connected YouTube social account. Fields left out keep their current value. The API answers with the updated playlist.
itemCountand the playlist items endpoint returns an empty page.Parámetros body
socialAccountId*inttitlestringdescriptionstringprivacyStatusstringCampos devueltos
idstringtitlestringdescriptionstringthumbnailUrlstringitemCountint|nullprivacyStatusstringEjemplo
/social-accounts/youtube/playlists/:playlistIdBearer obligatorio6.7.Delete a YouTube playlist
Delete a playlist of a connected YouTube social account. The videos themselves are not deleted. The API answers 204 No Content.
itemCountand the playlist items endpoint returns an empty page.Parámetros query
socialAccountId*intEjemplo
/social-accounts/youtube/playlists/:playlistId/itemsBearer obligatorio6.8.List the videos of a YouTube playlist
Return one page of the videos of a YouTube playlist, in playlist order. The result is read from YouTube on each call and is not cached.
pageToken: send thenextPageTokenof the previous response until it is null. An unknown or inaccessible playlist returns 404 Not Found; a playlist created through this API moments ago returns an empty page instead.Parámetros query
socialAccountId*intsizeint50pageTokenstringCampos devueltos
itemsobject[]idstringvideoIdstringpositioninttitlestringaddedAtdatevideoPublishedAtdateprivacyStatusstringnextPageTokenstring|nullEjemplo
Ejemplo de respuesta
/social-accounts/youtube/playlists/:playlistId/items/:itemIdBearer obligatorio6.9.Move a video in a YouTube playlist
Move a video to another position of a YouTube playlist. The API answers with the moved item and its new position.
Parámetros body
socialAccountId*intposition*intCampos devueltos
idstringvideoIdstringpositioninttitlestringaddedAtdatevideoPublishedAtdateprivacyStatusstringEjemplo
/social-accounts/pinterest/boardsBearer obligatorio6.10.Get Pinterest boards
Return the boards of connected Pinterest social accounts, to choose the `pinterest.boardId` of a Pinterest post.
boardsarray is empty.force=trueto read them from Pinterest again.Parámetros query
socialAccounts*stringforceboolfalseCampos devueltos
PinterestAccountBoards[]PinterestAccountBoards[]socialAccountIdintboardsobject[]Ejemplo