API: getting started
Reference guide to using an organization API key; public API credentials are not issued in Release A.
An organization API key lets a script upload media, write posts, schedule them and read where they stand. This page walks through one complete flow. Every endpoint, with its parameters and responses, is in the API reference.
Reference only in Release A
Public app registration and API credentials are not available. These instructions require an authorized organization and API key; ViralSync is not issuing keys in this release.
1. Create a key
In the app, open your organization, go to Settings and open the Developers tab. Create a key with only the scopes the script needs. The key is shown once; store it like a password. Owners and admins can create and revoke keys.
export VIRALSYNC_KEY="vsk_1a2b3c4d_…"
export ORG="ws_…" # the organization id, not its slug
export BRAND="br_…" # a brand id from GET /brandsWhy the organization id starts with ws_
The prefix is historical and carries no meaning. It names an organization.
2. Call the API
Send the key as a bearer token. Every route names the organization in its path, and a key works
only for the organization it was created in. Listing brands needs the brands.read scope.
curl https://api.viralsync.io/v1/organizations/$ORG/brands \
-H "Authorization: Bearer $VIRALSYNC_KEY"3. Upload, post, schedule, read
This flow needs the scopes assets.write, posts.write, publications.write and
channels.read. Channels are connected by a person in the app; the script chooses among them.
B=https://api.viralsync.io/v1/organizations/$ORG/brands/$BRAND
H="Authorization: Bearer $VIRALSYNC_KEY"
# 1. Reserve an upload, send the file to the returned URL, then complete it
curl -X POST $B/assets -H "$H" -H 'Content-Type: application/json' \
-d '{"filename":"clip.mp4","contentType":"video/mp4","sizeBytes":1048576}'
curl -X PUT "$UPLOAD_URL" -H 'Content-Type: video/mp4' --data-binary @clip.mp4
curl -X POST $B/assets/$ASSET/complete -H "$H" -H 'Content-Type: application/json' -d '{}'
# 2. List the brand's channels and pick one
curl $B/channels -H "$H"
# 3. Create a draft and fill it
curl -X POST $B/posts -H "$H" -H 'Content-Type: application/json' -d '{}'
curl -X PATCH $B/posts/$POST -H "$H" -H 'Content-Type: application/json' \
-d '{"commonText":"Launch day","assetIds":["'$ASSET'"],"targets":[{"channelId":"'$CHANNEL'","settings":{}}]}'
# 4. Schedule it (or use "mode":"now")
curl -X POST $B/posts/$POST/publications -H "$H" -H 'Content-Type: application/json' \
-H 'Idempotency-Key: launch-2026-10-05' \
-d '{"mode":"schedule","scheduledAt":"2026-10-05T09:00:00Z","channelIds":["'$CHANNEL'"]}'
# 5. Read where it stands
curl $B/publications/$PUBLICATION -H "$H"The first call answers with the new asset and an upload plan. A small file gets one URL, as in the example. A large file gets several part URLs; see Uploading media.
Scheduling creates one publication for each channel. If channelIds is left out, the post goes to
every channel it targets.
Next steps
- Authentication and scopes lists what each scope opens.
- Errors and limits covers retries, rate limits and plan limits.