Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@getlatedev/node

Package Overview
Dependencies
Maintainers
1
Versions
214
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@getlatedev/node

The official Node.js library for the Late API

Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
2.9K
-25.02%
Maintainers
1
Weekly downloads
 
Created
Source

Late Node.js Library

npm version License

The official Node.js library for the Late API - schedule social media posts across Instagram, TikTok, YouTube, LinkedIn, X/Twitter, Facebook, Pinterest, Threads, and more.

Installation

npm install @getlatedev/node

Usage

import Late from '@getlatedev/node';

const late = new Late({
  apiKey: process.env['LATE_API_KEY'], // This is the default and can be omitted
});

async function main() {
  // Create and publish a post
  const post = await late.posts.create({
    body: {
      content: 'Hello from the Late SDK! 🚀',
      platforms: [
        { platform: 'twitter', accountId: 'acc_xxx' },
        { platform: 'linkedin', accountId: 'acc_yyy' },
      ],
      publishNow: true,
    },
  });

  console.log(post.data);
}

main();

Configuration

The client can be configured with the following options:

const late = new Late({
  apiKey: 'sk_...', // Defaults to process.env['LATE_API_KEY']
  baseURL: 'https://getlate.dev/api', // Default
  timeout: 60000, // Request timeout in ms
  defaultHeaders: {
    'X-Custom-Header': 'value',
  },
});

Examples

Schedule a Post

const post = await late.posts.create({
  body: {
    content: 'Scheduled post from the SDK',
    platforms: [{ platform: 'instagram', accountId: 'acc_xxx' }],
    scheduledFor: new Date('2025-02-01T10:00:00Z').toISOString(),
  },
});

Multi-Platform with Platform-Specific Content

const post = await late.posts.create({
  body: {
    content: 'Default content for all platforms',
    platforms: [
      {
        platform: 'twitter',
        accountId: 'acc_twitter',
        platformSpecificContent: 'Shorter content for X #hashtags',
      },
      {
        platform: 'linkedin',
        accountId: 'acc_linkedin',
        platformSpecificContent: 'Professional content for LinkedIn',
      },
    ],
    publishNow: true,
  },
});

List Posts

const { data } = await late.posts.list({
  query: {
    status: 'scheduled',
    limit: 20,
  },
});

for (const post of data.posts) {
  console.log(post.content, post.scheduledFor);
}

Upload Media

// 1. Get presigned URL
const { data: presign } = await late.media.getPresignedUrl({
  body: {
    filename: 'image.jpg',
    contentType: 'image/jpeg',
  },
});

// 2. Upload file
await fetch(presign.uploadUrl, {
  method: 'PUT',
  body: imageBuffer,
  headers: { 'Content-Type': 'image/jpeg' },
});

// 3. Create post with media
await late.posts.create({
  body: {
    content: 'Post with image',
    mediaUrls: [presign.publicUrl],
    platforms: [{ platform: 'instagram', accountId: 'acc_xxx' }],
    publishNow: true,
  },
});

Get Analytics

const { data: analytics } = await late.analytics.get({
  query: { postId: 'post_xxx' },
});

console.log('Impressions:', analytics.analytics.impressions);
console.log('Engagement:', analytics.analytics.engagementRate);

List Connected Accounts

const { data } = await late.accounts.list();

for (const account of data.accounts) {
  console.log(`${account.platform}: @${account.username}`);
}

Configure Webhooks

await late.webhooks.updateSettings({
  body: {
    url: 'https://your-app.com/webhooks/late',
    events: ['post.published', 'post.failed', 'account.disconnected'],
    secret: 'your-webhook-secret',
  },
});

Error Handling

import Late, { LateApiError, RateLimitError, ValidationError } from '@getlatedev/node';

const late = new Late();

try {
  await late.posts.create({ body: { ... } });
} catch (error) {
  if (error instanceof RateLimitError) {
    console.log(`Rate limited. Retry in ${error.getSecondsUntilReset()} seconds`);
  } else if (error instanceof ValidationError) {
    console.log('Validation errors:', error.fields);
  } else if (error instanceof LateApiError) {
    console.log(`API error ${error.statusCode}: ${error.message}`);
  }
}

API Reference

Posts

MethodDescription
posts.list(params)List posts
posts.create(params)Create a post
posts.get(params)Get a post
posts.update(params)Update a post
posts.delete(params)Delete a post
posts.retry(params)Retry a failed post
posts.bulkUpload(params)Upload multiple posts

Accounts

MethodDescription
accounts.list()List connected accounts
accounts.update(params)Update an account
accounts.delete(params)Disconnect an account
accounts.getFollowerStats()Get follower statistics
accounts.getAllHealth()Get health for all accounts

Analytics

MethodDescription
analytics.get(params)Get post analytics
analytics.getYouTubeDailyViews(params)Get YouTube daily views
analytics.getLinkedInAggregate(params)Get LinkedIn org analytics

See the API documentation for all available methods.

Requirements

  • Node.js 18 or later
  • An API key from Late

License

Apache-2.0

Keywords

late

FAQs

Package last updated on 15 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts