Skip to content

Facebook Pages

Genium connects Facebook Pages through a one-time OAuth ticket. Page and user tokens stay encrypted in D1 and are never returned by the API.

Connect

bash
curl -X POST https://auth.genium.one/api/social/connect-ticket \
  -H "Authorization: Bearer $USER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"provider":"facebook"}'

Open the returned connect_url, select the Pages Genium may manage, then list the saved Pages:

bash
curl https://auth.genium.one/api/facebook/pages \
  -H "Authorization: Bearer $USER_API_KEY"

Use the returned page_id in publishing requests.

Text or link post

bash
curl -X POST https://auth.genium.one/api/facebook/feed \
  -H "Authorization: Bearer $USER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"page_id":"PAGE_ID","message":"Hello from Genium","link":"https://genium.one"}'

Photo

bash
curl -X POST https://auth.genium.one/api/facebook/photos \
  -H "Authorization: Bearer $USER_API_KEY" \
  -F "page_id=PAGE_ID" \
  -F "photo=@photo.jpg;type=image/jpeg" \
  -F "caption=Photo caption #hashtag"

Send between two and ten images:

bash
curl -X POST https://auth.genium.one/api/facebook/carousel \
  -H "Authorization: Bearer $USER_API_KEY" \
  -F "page_id=PAGE_ID" \
  -F "message=Carousel caption" \
  -F "photos=@photo-1.jpg;type=image/jpeg" \
  -F "photos=@photo-2.jpg;type=image/jpeg"

Video

bash
curl -X POST https://auth.genium.one/api/facebook/videos \
  -H "Authorization: Bearer $USER_API_KEY" \
  -F "page_id=PAGE_ID" \
  -F "video=@video.mp4;type=video/mp4" \
  -F "title=Video title" \
  -F "description=Video description"

/api/facebook/upload remains an alias for existing clients.

Reuse a ready R2 object:

bash
curl -X POST https://auth.genium.one/api/facebook/videos \
  -H "Authorization: Bearer $USER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"page_id":"PAGE_ID","media_key":"videos/VIDEO_KEY","title":"Video title","description":"Video description"}'

Reel

bash
curl -X POST https://auth.genium.one/api/facebook/video_reels \
  -H "Authorization: Bearer $USER_API_KEY" \
  -F "page_id=PAGE_ID" \
  -F "video=@reel.mp4;type=video/mp4" \
  -F "title=Reel title" \
  -F "description=Reel description #hashtag"

Status

bash
curl "https://auth.genium.one/api/facebook/status?post_id=POST_ID" \
  -H "Authorization: Bearer $USER_API_KEY"

Text, photo, and carousel requests normally complete immediately. Videos and Reels can remain PROCESSING; poll until PUBLISH_COMPLETE. Completed video and Reel responses include permalink when Facebook returns it. Successful temporary-media cleanup returns media_deleted: true.

Delete a post

Delete a published Facebook post using the Genium post_id returned by the upload response:

bash
curl -X DELETE "https://auth.genium.one/api/facebook/posts?post_id=POST_ID" \
  -H "Authorization: Bearer $USER_API_KEY"

The endpoint deletes the Facebook object, marks the Genium post as DELETED, and removes temporary R2 media when retain_media was not requested.

Token lifecycle

Facebook Page tokens are renewed from the encrypted long-lived user token. If Meta revokes access or the user token expires, the connection becomes RECONNECT_REQUIRED; complete Facebook OAuth again.

Genium Social Hub