onepostly
Official Python SDK for the Onepostly API — publish, schedule, and read results across all supported social platforms with one request shape. See the docs for the current platform list.
Python 3.10+.
Installation
pip install onepostly
Usage
Every resource is its own API class built on a shared Configuration and ApiClient:
import os
from onepostly import ApiClient, Configuration
from onepostly.api.posts_api import PostsApi
configuration = Configuration(
api_key={"ApiKeyHeader": os.environ["ONEPOSTLY_API_KEY"]}, # sent as the `x-api-key` header
)
with ApiClient(configuration) as api_client:
posts = PostsApi(api_client)
response = await posts.create_post(
create_post_body={
"text": "Hello from Onepostly",
"mediaKind": "text",
"destinations": [{"connectionId": "…"}],
}
)
print(response.post.id, response.post.status) # "queued"
Methods are async and return deserialized pydantic models (PostResponse, ListPosts200Response, …). The …with_http_info() variants return an ApiResponse with status_code, headers, and raw_data alongside data.
Pass plain dicts anywhere a model is expected — pydantic validates and coerces them (alias names like connectionId and mediaKind are accepted on both keys and fields).
Scheduling
await posts.create_post(
create_post_body={
"text": "Tomorrow morning",
"scheduledFor": "2026-09-01T09:00:00", # timezone-naive local time
"timezone": "Europe/Istanbul",
"destinations": [{"connectionId": "…"}],
}
)
# 201 Created, status "scheduled"
Media
from onepostly.api.media_api import MediaApi
media_api = MediaApi(api_client)
with open("photo.jpg", "rb") as f:
upload = await media_api.upload_media(file=f)
media_url = upload.media.url
await posts.create_post(
create_post_body={
"text": "With an image",
"mediaKind": "image",
"mediaUrls": [media_url],
"destinations": [{"connectionId": "…"}],
}
)
Insights
from onepostly.api.insights_api import InsightsApi
insights_api = InsightsApi(api_client)
post_insights = await insights_api.get_post_insights(id=post_id)
for destination in post_insights.insights.destinations or []:
print(destination.platform, destination.metrics)
timeline = await insights_api.get_post_insights_timeline(
id=post_id,
var_from="2026-08-01", # inclusive, YYYY-MM-DD (`from` is a Python keyword)
to="2026-08-28", # inclusive, YYYY-MM-DD
)
Error handling
Every non-2xx response raises an ApiException subclass with the HTTP status, reason, and the raw response body attached. Subclasses map to status families (UnauthorizedException, ForbiddenException, NotFoundException, ConflictException, ServiceException, …):
from onepostly import ApiException
try:
await posts.create_post(create_post_body={/* … */})
except ApiException as error:
print(error.status, error.body)
# 402 {"error": {"code": "INSUFFICIENT_WALLET", "message": "…"}}
API reference
All methods take named keyword arguments.
| API class | Methods |
|---|---|
PostsApi |
create_post list_posts get_post cancel_post delete_post_destination |
MediaApi |
upload_media list_media delete_media |
ConnectionsApi |
list_connections get_connection_stats list_connection_media get_tik_tok_creator_info list_pinterest_boards create_pinterest_board connect_bluesky start_o_auth list_facebook_pages select_facebook_page |
InsightsApi |
get_post_insights get_post_insights_timeline |
CommentsApi |
list_comments create_comment delete_comment |
EngagementApi |
list_retweeters retweet undo_retweet like unlike bookmark remove_bookmark quote |
WebhooksApi |
list_webhook_event_types list_webhooks create_webhook get_webhook update_webhook delete_webhook rotate_webhook_secret list_webhook_deliveries test_webhook |
Representative signatures:
# PostsApi — id/destination-scoped actions take id / destination_id
await posts.create_post(create_post_body=…) # → PostResponse
await posts.list_posts(limit=None, offset=None) # → ListPosts200Response
await posts.get_post(id=…) # → PostResponse
await posts.cancel_post(id=…) # → PostResponse
await posts.delete_post_destination(id=…, destination_id=…) # remote-delete
# EngagementApi — body-bearing actions take a body model or dict
await engagement.retweet(id=…, destination_id_body={"destinationId": "…"})
await engagement.undo_retweet(id=…, destination_id=…)
await engagement.like(id=…, destination_id_body={"destinationId": "…"})
await engagement.quote(id=…, quote_body={"destinationId": "…", "text": "…"})
await engagement.list_retweeters(id=…, destination_id=None, limit=None, cursor=None)
# CommentsApi
await comments.create_comment(id=…, create_comment_body={"destinationId": "…", "text": "…"})
await comments.list_comments(id=…, destination_id=None, limit=None, cursor=None)
await comments.delete_comment(id=…, comment_id=…, destination_id=…)
# WebhooksApi
await webhooks.create_webhook(create_webhook_body={"name": "…", "url": "…", "events": […]})
await webhooks.update_webhook(id=…, update_webhook_body={…})
await webhooks.rotate_webhook_secret(id=…)
await webhooks.test_webhook(id=…)
Full request/response reference: onepostly.com/openapi.json
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file onepostly-0.2.5.tar.gz.
File metadata
- Download URL: onepostly-0.2.5.tar.gz
- Upload date:
- Size: 55.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a128aaebae488e89f1af819af0ff46ea90824308a51898841c55b7f5f8bbecc8
|
|
| MD5 |
09d2b9610cec4009a26fb76ea44b8dd8
|
|
| BLAKE2b-256 |
70afbe77f5b9ba421bad368fedb67c1a659dac775759d9e43521cfa791465626
|
Provenance
The following attestation bundles were made for onepostly-0.2.5.tar.gz:
Publisher:
generate.yml on onepostly/onepostly-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
onepostly-0.2.5.tar.gz -
Subject digest:
a128aaebae488e89f1af819af0ff46ea90824308a51898841c55b7f5f8bbecc8 - Sigstore transparency entry: 2663860004
- Sigstore integration time:
-
Permalink:
onepostly/onepostly-python@ff7b66f52bcb727e92d25ea66e32a0e2e1c62252 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/onepostly
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
generate.yml@ff7b66f52bcb727e92d25ea66e32a0e2e1c62252 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file onepostly-0.2.5-py3-none-any.whl.
File metadata
- Download URL: onepostly-0.2.5-py3-none-any.whl
- Upload date:
- Size: 136.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcb4c75b3438ecab32d222ad18bdbf9ed91fe2ce4e05b49070a0e8004b9fc49c
|
|
| MD5 |
c7c2b0115d2757097526f959bd7067b3
|
|
| BLAKE2b-256 |
95ace15018ff8ae9a392aeaaacb4044584eb7dbb010ecc29f377fb6e927c1740
|
Provenance
The following attestation bundles were made for onepostly-0.2.5-py3-none-any.whl:
Publisher:
generate.yml on onepostly/onepostly-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
onepostly-0.2.5-py3-none-any.whl -
Subject digest:
bcb4c75b3438ecab32d222ad18bdbf9ed91fe2ce4e05b49070a0e8004b9fc49c - Sigstore transparency entry: 2663860071
- Sigstore integration time:
-
Permalink:
onepostly/onepostly-python@ff7b66f52bcb727e92d25ea66e32a0e2e1c62252 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/onepostly
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
generate.yml@ff7b66f52bcb727e92d25ea66e32a0e2e1c62252 -
Trigger Event:
workflow_dispatch
-
Statement type: