Skip to main content
POST
/
v1
/
posts
Create a new post
curl --request POST \
  --url https://api.yalg.ai/v1/posts \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "content": "I used to think consistency came from discipline. It actually came from removing friction.",
  "platform": "linkedin",
  "anecdoteId": "018f9f41-22a1-74bb-9450-7dd0d21ab8ab"
}
'
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "content": "Post content here...",
  "authorId": "987fcdeb-51a2-43d7-8f9e-123456789abc",
  "anecdotes": [],
  "status": "drafted",
  "isActive": true,
  "createdAt": "2024-01-15T10:30:00Z",
  "updatedAt": "2024-01-15T10:30:00Z"
}

Authorizations

x-api-key
string
header
default:yalg_live_your_api_key
required

YALG Developer API key. Send it in the x-api-key header from a server-side environment only.

Body

application/json
content
string

The content of the LinkedIn post (optional for HOOK_CREATED status)

Maximum string length: 5000
Example:

"Just had an amazing experience at the tech conference! Here are my key takeaways..."

agentCreated
boolean

Whether the post was created by an agent

Example:

true

imageUrl
string

URL of an image to include in the post

Maximum string length: 255
Example:

"https://example.com/image.jpg"

videoUrl
string

URL of a video to include in the post

Maximum string length: 255
Example:

"https://example.com/video.mp4"

anecdoteIds
string<uuid>[]

UUIDs of the anecdotes this post is based on

Example:
[
"987fcdeb-51a2-43d7-8f9e-123456789abc",
"123e4567-e89b-12d3-a456-426614174000"
]
tags
string[]

Tags associated with the post for categorization

Example:
[
"technology",
"conference",
"networking",
"learning"
]
linkedInUrl
string

Original LinkedIn post URL

Maximum string length: 500
Example:

"https://www.linkedin.com/feed/update/urn:li:activity:1234567890"

originalTimestamp
string<date-time>

Original timestamp of the post (for imported posts)

Example:

"2023-12-01T10:30:00Z"

scheduledAt
string<date-time>

Scheduled publication timestamp for the post

Example:

"2023-12-01T15:30:00Z"

publishedAt
string<date-time>

Actual publication timestamp when the post was published

Example:

"2023-12-01T15:32:15Z"

likesCount
number

Number of likes/reactions on the post

Required range: x >= 0
Example:

42

commentsCount
number

Number of comments on the post

Required range: x >= 0
Example:

8

sharesCount
number

Number of shares/reposts of the post

Required range: x >= 0
Example:

3

impressionsCount
number

Number of impressions/views of the post

Required range: x >= 0
Example:

1250

status
enum<string>

Status of the post

Available options:
drafted,
scheduled,
published,
failed
Example:

"published"

targetPlatforms
enum<string>[]

Target platforms for publishing

Available options:
linkedin,
instagram,
facebook
Example:
["linkedin", "instagram", "facebook"]
instagramFormat
enum<string>

Instagram post format (carousel or single image)

Available options:
carousel,
single
Example:

"carousel"

authorId
string
deprecated

Do not send this field in public API requests. YALG ignores arbitrary owner identifiers and derives the owner from the authenticated API key.

Response

Post created successfully