Introduction
Welcome to the Planly API! You can use our API to schedule posts, upload medias, manage your channels and much more.
Authentication
To authorize, use this code:
fetch('https://app.planly.com/api/...', {
headers: {
'Authorization': 'Bearer api_key'
}
})
Make sure to replace
api_key
with your API key.
Planly uses API keys to allow access to the API. You can get your Planly API key from Settings > Security.
Planly expects for the API key to be included in all API requests to the server in a header that looks like the following:
Authorization: Bearer api_key
Schedules
List Schedules
fetch('https://app.planly.com/api/schedules/list', {
method: 'POST',
headers: { 'Authorization': 'Bearer api_key' },
body: JSON.stringify({
"team_id": "1ed3a4fa-ff8f-6166-a14e-6850a91715e8",
"cursor": null
})
})
Response:
{
"data": {
"schedules": [
{
"id": "1ede989b-3576-69b4-8c32-5662aa0940f5",
"media": [
{
"id": "1ede9882-1d09-6fc1-8c32-20e1401dc7b6",
"content_uri": "https://cdn.planly.com/media/...",
"thumbnail_uri": "https://cdn.planly.com/media/...",
"content_type": 1
}
],
"content": "hello world",
"status": 1,
"url": null,
"publish_on": "2023-05-18T09:00:00.688Z",
"created_at": "2023-05-03T08:08:34.699515Z"
}
],
"cursor": [
"1ede82f1-a089-67bf-a281-d3169ef8171d"
]
}
}
This endpoint retrieves schedules in a specified team.
HTTP Request
POST https://app.planly.com/api/schedules/list
Parameters
Name | Required | Description |
---|---|---|
team_id | yes | Id of team to retrieve its schedules. |
cursor | Use for pagination |
Delete Schedules
fetch('https://app.planly.com/api/schedules/delete', {
method: 'POST',
headers: { 'Authorization': 'Bearer api_key' },
body: JSON.stringify({
"ids": ["1ede989b-3576-69b4-8c32-5662aa0940f5"]
})
})
HTTP Request
POST https://app.planly.com/api/schedules/delete
Parameters
Name | Required | Description |
---|---|---|
ids | yes | UUID array with IDs' of schedules to delete. |
Create Schedule
fetch('https://app.planly.com/api/schedules/create', {
method: 'POST',
headers: { 'Authorization': 'Bearer api_key' },
body: JSON.stringify({
"publish_on": "2023-05-31T20:00:00.902+04:00",
"status": 1,
"contents": {
"facebook": {
"content": "Hello world",
"media": [
{
"id": "1edac5a8-954c-65dd-b024-66e2141ce8bc"
}
],
"options": {
"first_comment": true,
"first_comment_content": "This is first comment"
}
}
},
"social_channels": [
"fd0dc9f5-5aeb-4d98-9274-d621c9012b14"
]
})
})
HTTP Request
POST https://app.planly.com/api/schedules/create
Parameters
Name | Required | Description |
---|---|---|
publish_on | no | Planly will publish schedule at this date and time. If not specified, schedule should be published immediately |
status | yes | Status of schedule. 0 for Draft, 1 for Scheduled |
Media
Upload Media
fetch('https://app.planly.com/api/media/upload', {
method: 'POST',
headers: {
'Content-Type': 'video/mp4',
'Authorization': 'Bearer api_key',
'x-planly-team-id': '1ed3a4fa-ff8f-6166-a14e-6850a91715e8'
},
body: input.files[0]
})
Response:
{
"data": {
"id": "1edea754-f4f7-6304-a2ff-c8515f18b463",
"note": "",
"content_type": 0,
"content_length": 18977406,
"thumbnail_uri": "...",
"content_uri": "...",
"labels": [],
"starred": false,
"duration": 18918,
"resolution": {
"width": 1280,
"height": 720
},
"created_at": "2023-05-04T12:15:08.864641Z",
"created_by": {
"id": "1ed3a4fa-ff8f-615d-a14e-9b251da9cf9a",
"fullname": "John Doe",
"picture": "..."
},
"usage": 0
}
}
To upload media to your team use this endpoint. Supported content types are video/mp4
, image/png
, image/jpeg
, image/webp
.
HTTP Request
POST https://app.planly.com/api/media/upload
Headers
Name | Required | Description |
---|---|---|
Authorization | yes | User API key |
x-planly-team-id | yes | Id of team to upload media. |
Import Media from URL
fetch('https://app.planly.com/api/media/import', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer api_key'
},
body: JSON.stringify({
team_id: "1ed3a4fa-ff8f-6166-a14e-6850a91715e8",
link: "https://http.cat/200.jpg",
name: "Awesome cat photo",
})
})
The response is identical to
/media/upload
To import media from URL to your team use this endpoint. Supported media content types are video/mp4
, image/png
, image/jpeg
, image/webp
.
HTTP Request
POST https://app.planly.com/api/media/import
Parameters
Name | Required | Description |
---|---|---|
team_id | yes | Id of team to import media. |
link | yes | URL of remote media file. |
name | no | Description of media. |
List Media
fetch('https://app.planly.com/api/media/list', {
method: 'POST',
headers: { 'Authorization': 'Bearer api_key' },
body: JSON.stringify({
"team_id": "1ed3a4fa-ff8f-6166-a14e-6850a91715e8",
"cursor": null
})
})
Response:
{
"data": {
"medias": [
{
"id": "1ede9882-1d09-6fc1-8c32-20e1401dc7b6",
"note": "",
"content_type": 1,
"content_length": 200117,
"thumbnail_uri": "...",
"content_uri": "...",
"labels": [],
"starred": false,
"duration": 0,
"resolution": {
"width": 1412,
"height": 958
},
"created_at": "2023-05-03T07:57:21.646549Z",
"created_by": {
"id": "1ed3a4fa-ff8f-615d-a14e-9b251da9cf9a",
"fullname": "John Doe",
"picture": "..."
},
"usage": 0
}
],
"cursor": [
"1ed9cb26-c8e0-6b53-a4ea-721f892988ee"
]
}
}
This endpoint retrieves medias in a specified team.
HTTP Request
POST https://app.planly.com/api/media/list
Parameters
Name | Required | Description |
---|---|---|
team_id | yes | Id of team to retrieve its medias. |
cursor | Use for pagination |
Delete Media
fetch('https://app.planly.com/api/media/delete', {
method: 'POST',
headers: { 'Authorization': 'Bearer api_key' },
body: JSON.stringify({
"ids": ["1ede9882-1d09-6fc1-8c32-20e1401dc7b6"]
})
})
HTTP Request
POST https://app.planly.com/api/media/delete
Parameters
Name | Required | Description |
---|---|---|
ids | yes | UUID array with IDs' of medias to delete. |
Artificial Intelligence
Get Available Credits
fetch('https://app.planly.com/api/v2/ai/credits?teamId=874d98cd-34e4-4865-85f4-e9f16172a26f', {
method: 'GET',
headers: { 'Authorization': 'Bearer api_key' }
})
Response:
{
"data": 252
}
Get available AI credits left in a team.
HTTP Request
GET https://app.planly.com/api/v2/ai/credits
Query Parameters
Name | Required | Description |
---|---|---|
teamId | yes | Id of team |
Complete Prompt
fetch('https://app.planly.com/api/v2/ai/complete', {
method: 'POST',
headers: { 'Authorization': 'Bearer api_key' },
body: JSON.stringify({
teamId: "874d98cd-34e4-4865-85f4-e9f16172a26f",
prompt: "Who is the first president of USA?",
n: 1
})
})
Response:
{
"data": {
"id": "cmpl-7CUN5FhBapPkwAFRtKNhszvT9fxow",
"choices": [
{
"text": "The first president of the United States was George Washington."
}
]
}
}
Complete text prompt.
HTTP Request
POST https://app.planly.com/api/v2/ai/complete
Parameters
Name | Required | Description |
---|---|---|
teamId | yes | Id of team |
prompt | yes | Prompt as a text |
n | yes | How many results to generate |