Developer Documentation

API Reference

AI Marketing Brain integrates with supported social media platforms using official APIs and OAuth 2.0 authentication.

This documentation provides an overview of supported integrations, authentication methods and available platform capabilities.

OAuth 2.0 Security
✔ Official APIs ✔ HTTPS ✔ OAuth 2.0 ✔ Secure Tokens ✔ Privacy First

Supported APIs

AI Marketing Brain integrates only with official APIs provided by supported social media platforms. We do not use unofficial APIs, browser automation, credential scraping or password collection.

TikTok API

OAuth authentication, profile access and content publishing through the official TikTok Developer Platform.

Facebook Graph API

Secure publishing, page management and analytics using Meta Graph API.

Instagram Graph API

Business account publishing using the official Instagram Graph API.

YouTube Data API

Video publishing and channel management using Google's official APIs.

LinkedIn API

Company page publishing and professional content distribution.

Future Integrations

Additional official APIs may be added as they become available.

Authentication

OAuth 2.0 Authorization

Every user must explicitly authorize AI Marketing Brain before any action can be performed on their behalf.

  • User consent is always required.
  • Passwords are never requested.
  • Authorization is handled by the platform.
  • Access tokens are securely stored.
  • Permissions are limited to approved scopes.
  • Users can revoke access at any time.

Base URL

AI Marketing Brain communicates securely with official platform APIs.

https://brainafricalabs.com/api/v1/

All requests are transmitted through HTTPS.

Main Endpoints

Endpoint Description Authentication
/oauth/connect Connect a social account OAuth 2.0
/posts/create Create a publication draft Required
/posts/publish Publish approved content Required
/media/upload Upload images or videos Required
/analytics Retrieve campaign statistics Required

HTTP Methods

GET

Retrieve information without modifying any resource.

POST

Create content or submit publication requests.

DELETE

Remove authorized resources when supported by the platform.

Request Example

POST /posts/create

{
  "platform":"facebook",
  "caption":"Hello Africa!",
  "media":"image.jpg"
}

Response Example

HTTP/1.1 200 OK

{
  "status":"success",
  "post_id":"987654321",
  "message":"Draft created successfully."
}

API Workflow

1

User Authentication

The user signs in and authorizes AI Marketing Brain through OAuth 2.0.

2

Create Content

AI generates captions, images or campaign drafts.

3

User Review

Every publication is reviewed and approved by the user.

4

Publish

Content is published using the official platform API.

Rate Limits

Platform Limits

AI Marketing Brain respects the rate limits imposed by each official API provider.

  • No request flooding.
  • No automated bypass mechanisms.
  • Automatic retry with exponential backoff.
  • Compliance with platform quotas.
  • Continuous monitoring of API usage.

Error Handling

400 Bad Request

The request could not be processed because one or more required parameters are missing or invalid.

401 Unauthorized

Authentication is required or the OAuth access token has expired or is invalid.

403 Forbidden

The authenticated account does not have permission to perform the requested action.

404 Not Found

The requested resource or endpoint does not exist.

429 Too Many Requests

API rate limits have been exceeded. Retry after the recommended waiting period.

500 Internal Server Error

An unexpected server error occurred. Please try again later or contact support.

HTTP Response Codes

Status Description
200 OK Request completed successfully.
201 Created A new resource has been created.
204 No Content Request completed successfully without a response body.
400 Bad Request Invalid request parameters.
401 Unauthorized Authentication required.
403 Forbidden Permission denied.
404 Not Found Requested resource not found.
429 Too Many Requests Rate limit exceeded.
500 Internal Server Error Unexpected server error.

Integration Best Practices

Recommended Practices

  • Always use HTTPS for API communication.
  • Use official OAuth 2.0 authentication only.
  • Never request or store user passwords.
  • Store OAuth access tokens securely.
  • Refresh expired tokens using official refresh mechanisms.
  • Respect API quotas and rate limits.
  • Validate all user input before sending requests.
  • Log API errors for troubleshooting.
  • Review platform developer policies regularly.
  • Keep API integrations up to date.

Developer FAQ

Does AI Marketing Brain use official APIs?

Yes. We integrate exclusively with official APIs provided by supported platforms.

Do you collect user passwords?

No. Authentication is handled exclusively through OAuth 2.0 authorization.

Can users revoke access?

Yes. Users can revoke authorization directly from the connected platform or from AI Marketing Brain.

Are API requests encrypted?

Yes. All API communication uses HTTPS with TLS encryption.

Does the platform respect API limits?

Yes. AI Marketing Brain automatically respects platform quotas and rate limits.

Coming Soon

API Version 2

Enhanced publishing capabilities and expanded analytics.

Webhooks

Receive real-time notifications for publication events and account changes.

Developer Dashboard

Manage API credentials, monitor usage and review activity logs.

SDKs

Official SDKs for JavaScript, Python and PHP to simplify API integration.

Sandbox Environment

Dedicated testing environment for developers before production deployment.

Additional Platforms

Future support for new official social media APIs as they become available.

Start Building with AI Marketing Brain

Explore our security documentation, OAuth implementation and platform features to understand how Brain Africa Labs builds secure AI-powered marketing solutions using official APIs.