Node.js and Python SDKs for Publishing Posts
Node.js and Python SDKs provide a typed way to publish posts, schedule content, manage account connections, work with media, and read analytics, profiles, and notifications through the same REST API. Both clients are generated from the same OpenAPI contract, so request types, response models, resources, and errors stay aligned across languages.
Install
Install the Node.js client with npm install {{NODE_PACKAGE_NAME}} and the Python client with pip install {{PYTHON_PACKAGE_NAME}}. Set {{API_KEY_ENV_VAR}} in your environment so the client can read the API key automatically, and keep the key out of source code. The install commands and client names are shown in the Install the Node.js SDK and Install the Python SDK examples.
Publish with Node.js
In Node.js, create the client with new {{NODE_CLIENT_NAME}}() and call client.posts.create with a body object containing content, platforms, and publishNow. Each entry in platforms contains a platform value and an accountId. The complete call is shown in the Publish with Node.js example.
Publish with Python
In Python, create the client with {{PYTHON_CLIENT_NAME}}() and call client.posts.create with flattened arguments content, platforms, and publish_now. Each entry in platforms contains a platform value and an accountId. The complete call is shown in the Publish with Python example.
Coverage and field map
The SDKs cover posts, scheduling, account connections, media, analytics, profiles, notifications, and AI tools, with typed errors and configurable timeouts. The field map table shows how content, platforms, platform, accountId, publishNow, and publish_now map between Node.js and Python, and the plain HTTP example shows the equivalent POST request using the x-access-key header.
SDK versus plain HTTP
Plain HTTP remains available with the same contract: POST {{API_BASE_URL}}/v1/posts with content, platforms[].platform, platforms[].accountId, and publishNow. Choose the SDK for typed models and error handling, or plain HTTP for direct request control without an SDK dependency.
| Field | Node.js | Python | Plain HTTP | Required |
|---|---|---|---|---|
| Post text | body.content | content | content | Yes |
| Target platforms | body.platforms | platforms | platforms | Yes |
| Platform name | platforms[].platform | platforms[].platform | platforms[].platform | Yes |
| Account identifier | platforms[].accountId | platforms[].accountId | platforms[].accountId | Yes |
| Publish immediately | body.publishNow | publish_now | publishNow | Yes in examples |
| API key | {{API_KEY_ENV_VAR}} | {{API_KEY_ENV_VAR}} | x-access-key header | Yes |
Field names preserved from source examples; values are inline variables.
Frequently asked questions
How do I configure the API key and choose between the Node.js and Python call shapes?
Set {{API_KEY_ENV_VAR}} in your environment and create the client without passing the key in code. The Node.js example uses a body object with publishNow, while the Python example passes flattened arguments with publish_now; both use content, platforms, platform, and accountId with the same values.
When should I use an SDK instead of plain HTTP?
Use the SDK when typed request and response models, typed errors, and configurable timeouts are useful. Use plain HTTP with POST {{API_BASE_URL}}/v1/posts and the x-access-key header when direct control over the request is preferable and no SDK dependency is wanted.
What should I check if a publish call fails?
Check the field map for the exact names in each language, confirm {{PLATFORM_1}} and {{PLATFORM_2}} are supported values, and confirm {{ACCOUNT_ID_1}} and {{ACCOUNT_ID_2}} match the connected account identifiers. A missing API key, an unsupported platform, or a malformed accountId will cause the create call to fail, so validate those values before publishing.
curl -X POST "{{API_BASE_URL}}/v1/posts" \
-H "x-access-key: ${{API_KEY_ENV_VAR}}" \
-H "Content-Type: application/json" \
-d '{
"content": "A short example update.",
"platforms": [
{ "platform": "{{PLATFORM_1}}", "accountId": "{{ACCOUNT_ID_1}}" },
{ "platform": "{{PLATFORM_2}}", "accountId": "{{ACCOUNT_ID_2}}" }
],
"publishNow": {{PUBLISH_NOW}}
}'