fopost library

The official Dart SDK for the FoPost API.

Schedule, publish and analyze social media posts across every connected platform. Start with FoPost:

import 'package:fopost/fopost.dart';

final client = FoPost(apiKey: 'fp_...');
final workspaces = await client.workspaces.list();
client.close();

Classes

Account
A connected social account.
AccountAnalyticsHistory
An account's stored snapshots, newest first.
AccountDetail
An account with the workspace that owns it.
AccountGroup
A named set of connected accounts in one workspace.
AccountGroupsResource
Account groups, named sets of accounts a post can target at once.
AccountHealth
One account's connection health.
AccountHealthStatus
How healthy a connected account's credentials are.
AccountHealthSummary
The health of every account the key can reach.
AccountPlatformMetrics
What only this network reports, in its own vocabulary: ad-break earnings, story taps, a retention curve, the search terms behind a listing.
AccountSnapshot
One point in an account's history.
AccountsResource
Connected social accounts.
AccountValidation
Whether an account's stored credentials still work.
ActivityActor
Who did something: user, api_key, agent or system.
ActivityEvent
One thing that happened in a workspace.
ActivityKind
Activity kinds. ActivityKind.security is the audit log: its rows are append-only and, unlike the rest, never expire.
ActivityPage
One page of activity, newest first.
A boost or standalone ad created through FoPost.
AdAccountRef
An ad account a connection can spend from.
AdAccountTree
An ad account's campaigns, each with its ad sets and their ads.
AdActivity
One change recorded on an ad account.
AdBudget
How much a boost or ad may spend.
AdBudgetType
How a budget is spent.
AdBusinessCenter
A Business Center, or the network's equivalent grouping of ad accounts.
AdCampaign
A campaign, by the platform's id. Read live, never stored.
AdComment
A comment on an ad, read live from the network and never stored.
AdCommentsPage
One page of an ad's comments; pass nextCursor back as after.
AdCompany
One row of a company-list upload.
AdConnection
A grant to an ads platform.
AdCreative
A creative in an ad account's library.
AdCreativeCard
One card of a carousel creative.
AdCreativeFormat
The creative formats createCreative builds.
AdCreativesResult
The creatives on an ad account.
AdGoal
What a boost or ad optimizes for.
AdIdentity
The account an ad runs as. Meta calls it a Page, TikTok an identity; an identity id is what every route calls a pageId.
AdInsights
Lifetime delivery numbers from an ad's last refresh.
AdInsightsBreakdown
How an insights report can be split.
AdInsightsReport
Insights for one campaign, ad set or ad over a date range.
AdLabel
Groups campaigns, ad sets and ads for reporting.
AdLibraryEntry
One public archive entry. Read live on every search and stored nowhere.
AdLibraryPage
One page of archive results.
AdObjectLevel
The levels of the campaign tree bulkSetStatus can act on.
AdObjectRef
A campaign, ad set or ad named in bulkSetStatus.
AdPageRef
A Page a connection can publish ads as.
AdPixel
A tracking pixel on an ad account.
AdProvider
An ad network from the API's registry.
AdSet
An ad set, by the platform's id. Read live, never stored.
AdSource
A connection with the ad accounts and Pages its grant reaches.
AdsResource
Ads: boosts, standalone ads, the campaign tree, creatives, catalogs, audiences, predictions, the public ad archive, insights and lead forms on connected ad accounts.
AdStatus
The statuses a boost or ad can be set to.
AdStudy
An A/B study splitting traffic across its cells.
AdStudyCell
One arm of an A/B study: the campaigns it tests.
AdTargeting
Who a boost or ad is shown to.
AdTargetingLocation
A place in a targeting spec, as searchTargeting names it.
AdTargetingRef
An interest, behavior or income bracket in a targeting spec.
AdTrackingMacro
A token a network expands in a link's tracking parameters at delivery time.
AnalyticsDeltas
Period-over-period changes, as fractions. A null field means there was no earlier period to compare against.
AnalyticsOverview
The headline roll-up across every account in scope.
AnalyticsResource
The cross-account reporting surface.
AnalyticsTimeSeries
Daily activity over the window.
ApiMessage
The bare acknowledgement several deletes answer with.
Audience
A saved audience on an ad account.
AudienceCreated
What creating an audience returned.
AudienceField
One custom-field clause in an audience filter.
AudienceFilter
Who a broadcast or an enrollment resolves to, expressed over contacts.
AudienceSpec
How to build a saved audience.
AudiencesResult
The audiences and pixels on an ad account.
Automation
One trigger and the steps behind it.
AutomationAction
The actions an automation step can take.
AutomationRun
One execution of an automation.
AutomationRunLog
One step's log entry within a run.
AutomationRunSummary
A run as it appears in the dashboard roll-up.
AutomationsResource
Automations: a trigger plus the steps it runs.
AutomationStats
Automation counts and recent runs.
AutomationStep
One action in an automation, in position order.
AutomationToggle
An automation's active flag after toggling.
AutomationTrigger
The events that can start an automation.
AutomationTriggerResult
The run a webhook trigger started.
BidPricing
What the auction costs, in minor units of the ad account currency.
BlogArticle
An article as a list shows it, without its body.
BlogArticleFull
An article with its body, outline and images.
BlogArticleImage
An image attached to an article.
BlogArticlePublished
The data of an article.published webhook.
BlogArticleStatus
The statuses an article moves through.
BlogGoal
What a blog is for; steers suggested terms and keyword ranking.
BlogImageTier
The image quality tiers an article can be illustrated at.
BlogKeyword
A keyword in the plan.
BlogKeywordStatus
The statuses a keyword moves through.
BlogPlanRun
The last keyword research run.
BlogPlanRunStatus
The statuses a keyword research run moves through.
BlogResource
The blog: settings, the keyword plan, and the articles written from it.
BlogSettings
A workspace's blog configuration.
BlogSettingsUpdate
The answer to a settings update.
BlogsResource
Articles and products that already live on a connected site.
BlogTargetKind
Where published articles go.
BlogWebsiteTest
The outcome of a test delivery to the website target.
BlueskyLanguages
The default post languages for a Bluesky connection.
BoostableDelivery
One live delivery of a boostable post.
BoostablePost
A published post that can be boosted.
Broadcast
One message, sent into conversations the workspace already has.
BroadcastCounts
What became of a broadcast's recipients, by status.
BroadcastRecipient
One contact on one broadcast, and what became of their message.
BroadcastSent
What a send started.
BroadcastsResource
Broadcasts: one message into every conversation the workspace already has with a segment of its contacts.
BudgetValueType
How the ad platform reads a high-demand period's budget value.
BulkAdStatusResult
What happened to one object in bulkSetStatus.
BulkImportedPost
One post a committed CSV import created.
BulkImportResult
What a committed CSV import created. Keep batchId to roll it back.
BulkImportRow
One CSV row as the bulk-import validator read it.
BulkImportValidation
The dry run of a CSV import.
BulkResult
How many posts a bulk action changed.
CancelResult
What a cancel stopped.
CatalogBatchResult
What a catalog product batch was accepted as.
CatalogProduct
One product in a catalog. priceMinor is minor units of currency.
CatalogProductsPage
One page of catalog products; pass nextCursor back as after.
CatalogProductWrite
One upsert or delete in a catalog batch, keyed by your own retailer id. Use CatalogProductWrite.upsert and CatalogProductWrite.delete.
CollectError
One account that failed during a collection run.
CollectPostDelivery
What the on-demand refresh did for one delivery.
CollectPostResult
What one post's refresh managed.
CollectSummary
What a collection run refreshed.
CommunitiesResource
The communities an account can post into.
Community
An X community linked to an account.
CommunitySearchResult
A community as search returns it, before it is linked to an account.
Contact
One person behind the inbox, however many handles they write from.
ContactChannel
One handle on one network.
ContactConversation
One inbox thread a contact appears in.
ContactField
A column the workspace invented.
ContactImportResult
What an import did.
ContactImportSkip
One CSV row that was not stored, and why.
ContactLabel
A workspace label put on a contact.
ContactsResource
Contacts, the people behind the inbox.
ContentBlock
One text-plus-media unit. A single post has one block; a thread has one per entry, in order.
ContentDecay
How engagement accumulates as a post ages.
ContentSignal
Advisory feedback from a preflight check. Blockers arrive as issues instead.
ConversationAnalytics
One page of per-thread inbox numbers.
ConversationAnalyticsRow
How one thread performed over the period.
ConversionEvent
One conversion sent back to the network.
ConversionMetrics
What a conversion rule recorded over a date range.
ConversionRule
How the network attributes a sale or a sign-up back to an ad set.
DecayBand
One age band of the content decay report.
Delivery
One account's delivery record for a post.
DeliveryStatus
The statuses one account's delivery moves through.
Demographics
An audience breakdown.
DemographicsAccountRef
An account named in a demographics response.
DemographicsAudience
The audiences a demographics breakdown can describe.
DemographicsBucket
One slice of an audience: a value and its share.
DiscordAck
What a Discord delete, pin or role assignment answers.
DiscordChannel
A Discord text channel the bot can post to.
DiscordIdentity
The nickname and avatar the bot wears in the server.
DiscordMember
A person in the connected server.
DiscordMessage
A message in the connected channel.
DiscordMessageRef
A message the bot put somewhere.
DiscordRole
A role in the connected server.
DiscordScheduledEvent
An event on the server's calendar.
DiscordThread
A thread started on a message.
DuplicatedPost
The id and status of the copy duplicate created.
Enrolled
How many contacts a call put on the sequence.
Enrollment
One contact walking one sequence.
EnrollmentCounts
Where a sequence's enrollments stand, by status.
ExceededAccount
An account that has run out of delivery attempts.
ExternalAd
An ad on a connected ad account that was made outside FoPost.
FeedLead
A lead stored from a subscribed Page.
FoPost
The FoPost API, one client per API key.
FoPostFile
One file for an upload, held as bytes or opened as a stream.
FrequencyBand
The weeks that shared a cadence, folded together.
FrequencyWeek
One week of posting. weekStart is the Monday, UTC, as YYYY-MM-DD.
GoogleAdScheduleSlot
One slot of a campaign's ad schedule.
GoogleAdsResource
Google Ads: keywords, assets, Performance Max asset groups, Local Services leads, conversions and raw GAQL.
GoogleAdsScope
The connection and the Google Ads account a call runs against.
GoogleAsset
A sitelink, callout or structured snippet.
GoogleAssetGroup
A Performance Max asset group.
Where an asset is attached; one with no links serves nowhere.
GoogleAssets
The account's assets with the links that place them.
GoogleBidStrategy
A portfolio bid strategy on the account.
GoogleBusinessResource
Manage a connected Google Business Profile location: the profile itself, attributes, food menus, services, photos, place action links, verification and performance.
GoogleConversionAction
A conversion action on the account.
GoogleKeyword
A keyword on an ad group.
GoogleKeywordIdea
A keyword idea, or the historical metrics of one.
GoogleLocalServicesLead
A lead from Local Services Ads, read live and never stored.
GoogleOptimizationScore
Google's estimate of how well the account is set up, from 0 to 1.
GoogleOptimizationScoreCampaign
One campaign's optimization score.
GoogleRecommendation
One of Google's own recommendations for the account.
GoogleRecommendationImpact
What Google projects applying a recommendation would change. A null field is one Google does not estimate for that recommendation.
GoogleSearchTerm
What someone actually searched, with the metrics it earned.
GoogleSharedSet
A negative keyword list.
HealthWarning
An account whose credentials looked shaky when a post was published.
HighDemandPeriod
A window the ad platform should expect heavier spend over.
InboxAccount
A connected account, flagged with what the inbox can read for it.
InboxAccountRef
The connected account an inbox row belongs to.
InboxApproval
A drafted reply a person still has to send.
InboxAttachment
A file attached to an inbox item.
InboxConversation
One direct-message thread.
InboxConversationStart
What opening a DM produced.
InboxDecision
The outcome of approving or rejecting a drafted reply.
InboxDmReconnect
An account whose DM access must be granted again.
InboxHandover
The outcome of a Messenger thread hand-over.
InboxItem
A comment, mention, review or direct message on a connected account.
InboxItemState
The states an inbox item moves through.
InboxItemType
The kinds of item the inbox collects.
InboxParticipant
The other side of a direct-message thread.
InboxPlatform
What the inbox supports on one network.
InboxPostContext
The platform post an item sits under, whoever published it.
InboxRefreshResult
What a manual inbox refresh did.
InboxReplyRef
Where a reply landed on the platform.
InboxReplyResult
What a reply produced: the updated item and where the reply landed.
InboxResource
The inbox: comments, mentions, reviews and direct messages on connected accounts.
InboxSort
The orders an inbox list can be returned in.
InboxThread
One platform post and the comments it has collected, or one review left on the business.
InsightsMetrics
Delivery numbers over a date range.
InsightsRow
One slice of a broken-down report, or one day of a daily one.
InstagramAudio
A track a Reel can carry.
InstagramPublishingLimit
What this account has published in the rolling window, and what is left.
InstagramStory
A story still inside its 24 hours.
InstagramStoryInsights
The insight set for one story.
IosCampaignLimits
How many iOS 14 campaigns an ad account may run at once, per app.
KnowledgeMatch
One retrieved passage, with the source it came from so a reply can cite it.
KnowledgeResource
The workspace knowledge base: what the workspace has told FoPost about itself.
KnowledgeSource
One thing the workspace has told FoPost about itself: an FAQ, a note, a page on its own site, or a plain-text/CSV file from the media library.
KnowledgeSyncResult
What a sync answers: the source, and that it is queued.
Label
One campaign tag posts are grouped by.
LabelAnalytics
One campaign label's performance.
LabelsResource
Labels, the campaign tags posts are grouped by.
Lead
A lead a form collected.
LeadField
One answer on a lead.
LeadForm
An instant lead form on a Page.
LeadFormDetail
An instant lead form with its settings.
LeadFormQuestion
The questions an instant lead form can ask.
LeadFormSource
A connection's Page and the lead forms on it.
LeadPage
A Page whose leads are stored into the feed as they arrive.
LeadPageSubscription
What subscribing a Page returned.
LeadsFeedPage
One page of the stored leads feed.
LeadsPage
One page of leads.
LinkedInMention
An entity a LinkedIn post can mention.
MediaItem
One attachment on a content block.
MediaLibraryItem
One stored asset in the media library.
MediaResource
The media library. Uploads count against the plan's storage allowance and are reachable with the posts scope.
MessagingDestination
Where a messaging ad opens a conversation.
MetaGreetingText
One locale's greeting, up to 160 characters.
MetaIceBreaker
A tappable prompt Messenger or Instagram shows before the first message.
MetaMenuItem
A persistent-menu item: a postback carrying payload, or a web_url carrying an http(s) url. The unused one stays null and is not sent.
MetaPersistentMenuEntry
One locale's menu; default is the fallback every language uses.
MetricChange
One reading, as the changes feed reports it.
MetricChangePage
One page of readings. Feed cursor back as the next since.
MovedAccount
Where an account lives after AccountsResource.move.
NativePost
A post on the account that never went out through FoPost.
NativePostMetrics
The freshest reading held for a post made outside FoPost.
NetworkAd
An ad inside an ad set, by the platform's id. Read live, never stored.
OverviewAccount
One account's contribution to an overview.
Page<T>
A page of results and the metadata describing where it sits.
PageMeta
One page of a paginated list.
PartnershipCreator
A creator who allowlisted this advertiser for partnership ads.
PinterestBoard
A Pinterest board a Pin can land on.
PlannedAccount
One account named in a dry-run plan.
PlatformBreakdown
One platform's share of an overview.
PlatformMetricRow
One metric a network reports under its own name.
PlatformMetricsBlock
One side of a per-network metric set: the account itself, or its newest measured post. externalPostId is null on the account side.
Post
A composed post and everything scheduled or delivered from it.
PostAccountResult
One account a post targets, with its delivery outcome.
PostAnalytics
A post's performance, totalled and per platform.
PostAnalyticsTotals
A post's totals across every platform it reached.
PostingFrequency
Weekly cadence set against what each cadence earned per post.
PostLabelRef
A label as it appears on a post.
PostPlatformAnalytics
A post's performance on one platform.
PostPlatformMetrics
One platform's numbers for a post. A null field means the platform does not report that metric.
PostsResource
Posts, publishing, deliveries, and bulk operations.
PostsTable
A page of posts with their delivery breakdown.
PostsTablePlatform
One platform on a posts-table row.
PostsTableRow
One row of the posts table, with its per-platform delivery breakdown.
PostStatus
The statuses a post moves through.
PostTimeline
Every reading held for one post, one timeline per delivery.
PreflightAccount
One account's readiness. issues block publishing; signals are advisory.
PreflightResult
A post checked against every target platform, without publishing.
PresignedUpload
A presigned direct-upload slot from POST /media/presign.
PrimaryAccount
An account's primary flag after toggling.
ProductCatalog
A product catalog on the connection's business portfolio, read live.
ProductFeed
Keeps a catalog in step with a product file you host.
ProductFeedUpload
One run the ad platform made of a product feed.
ProductSet
The slice of a catalog one catalog ad runs from.
PublishDelivery
One account's delivery as reported by publish or retry.
PublishResult
The outcome of a publish.
PublishRun
One attempt at publishing a post, with its per-account results.
PublishRunDelivery
One account's outcome within a single publish run.
RateLimit
The per-key, per-minute budget the API reports on every response.
ReachEstimate
How many people a targeting spec could reach.
ReachFrequencyPrediction
A priced flight. Nothing is bought until it is reserved.
RedditFlair
A post flair a subreddit offers.
RedditSubreddit
A subreddit a Reddit account can post to.
RedditSubredditRule
One rule a subreddit publishes.
RefreshedToken
When a refreshed credential now expires.
RemoteArticle
An article that already lives on a connected site.
RemoteBlog
A blog on a connected site.
RemoteProduct
A product on a connected store.
RenamedAccount
An account's names after AccountsResource.rename.
RetryResult
What a retry re-sent, and what it could not.
Sequence
A series of messages, each a delay after the one before.
SequencesResource
Drip sequences: a series of messages, each a delay after the one before, walked per enrolled contact.
SequenceStep
One message and how long after the previous step it goes out.
SlackChannel
A Slack channel the app can post to.
SlackIdentity
The name and icon a Slack account posts under.
SlackMember
A person in the connected Slack workspace.
SparkPost
A post already live on the network, offered as the source of a Spark ad.
StreakDay
One day of posting activity.
SupplyForecast
What an audience would deliver at a budget, over the network's own window.
TargetingOption
A location, interest, behavior or income bracket, as the platform names it.
TargetingType
The kinds of targeting option searchTargeting can look up.
TelegramBotCommand
One entry in a Telegram bot's command menu.
TelegramConnectCode
A one-time code that connects a Telegram chat when sent to the bot.
TelegramConnectStatus
Where a Telegram connect code stands.
TikTokCreatorInfo
The switches TikTok enforces at publish time, set on the TikTok account.
TikTokMusic
A track from TikTok's Commercial Music Library.
TikTokPlace
A place a post can be tagged with.
TikTokVideoSource
One of the account's own videos, resolved from a share link.
TimelineDelivery
One delivery's readings: the same post on two networks decays differently.
TimelineDelta
What moved between one reading and the one before it.
TimelinePoint
One reading of a post.
TimeSeriesPoint
One day of activity.
TopPost
One high-performing post.
TopPostMetrics
A top post's numbers.
TopPostPlatform
One platform a top post reached.
Unenrolled
How many enrollments a call stopped.
UploadedMedia
An asset as it comes back from an upload, shaped to drop straight into a post's content block.
UploadLimits
What an account may upload, from GET /media/limits.
UploadLimitTier
The next upload tier an account can reach by connecting more accounts.
ValidateLengthPlatform
One platform's count from client.validate.length.
ValidateLengthResult
The result of client.validate.length.
ValidateMedia
One file to check with client.validate.post.
ValidateMediaResult
The result of client.validate.media.
ValidatePostPlatform
One platform's verdict from client.validate.post.
ValidatePostResult
The result of client.validate.post.
ValidateResource
Standalone checks that store nothing: a draft against its platforms, a text's length, a media URL, or a subreddit.
ValidateSubredditResult
Whether a subreddit exists and takes a post from one account.
ValueRule
Weights one condition's conversions.
ValueRuleSet
Weights conversions so some audiences count for more than others.
Webhook
One outbound webhook subscription.
WebhookEnvelope
The envelope every FoPost webhook delivers.
WebhookEvent
The events a webhook subscription can ask for.
WebhooksResource
Outbound webhooks, the push counterpart to polling a post's deliveries.
WebhookSubscription
What the network delivers to the FoPost webhook for one account.
WhatsappBlockResult
What the platform took and what it refused.
WhatsappCommerceSettings
Whether the cart and catalog show on the number, and which catalog is linked.
WhatsappEncryptionKeyStatus
Whether a business public key is registered. The key itself never comes back.
WhatsappFlow
An in-chat form. The platform validates it and owns its status.
WhatsappFlowJsonResult
The platform's verdict on an uploaded definition. It answers with the errors rather than refusing the upload, so they arrive as data.
WhatsappFlowResponse
What one person submitted through a flow.
WhatsappFlowValidationError
One problem the platform found in a flow definition.
WhatsappGroup
A group on the business number. Participation is invite-only: no endpoint adds anyone, so inviteLink is how they join.
WhatsappProfile
The business profile on a WhatsApp number, plus how the platform rates it.
WhatsappResource
A WhatsApp Business connection: a number the customer already owns.
WhatsappSandboxSession
A sandbox invitation. Only the last four digits of the tester's number travel; the number itself is never stored.
WhatsappTemplate
A message template. status is the review outcome the platform assigned; nothing marks a template approved but the platform.
Workspace
One tenant. Every other resource is scoped to a workspace.
WorkspaceAccountAnalytics
One account's follower and post counts within a workspace roll-up.
WorkspaceAccountRef
A connected account as listed on a workspace.
WorkspaceAnalytics
The follower and post roll-up for one workspace.
WorkspacesResource
Workspaces, the tenant boundary every other resource is scoped to.
WorkspaceType
The kinds of workspace a plan can hold.
YouTubeCaptionTrack
A caption track on one of the channel's videos.
YouTubePlaylist
A playlist on the connected YouTube channel.
YouTubeTranscript
One caption track read back as text, in SRT.

Constants

foPostVersion → const String
The version of this SDK, reported in the User-Agent.
webhookDeliveryHeader → const String
The header carrying the delivery id.
webhookEventHeader → const String
The header naming the event.
webhookSignatureHeader → const String
The header carrying the HMAC-SHA256 of the raw body.
webhookSignatureTolerance → const Duration
How far a delivery's timestamp may sit from the receiver's clock.
webhookTimestampedSignatureHeader → const String
The header carrying the HMAC-SHA256 of <timestamp>.<raw body>.
webhookTimestampHeader → const String
The header carrying the unix-seconds timestamp the delivery was signed at.

Functions

parseRetryAfter(String? raw) → Duration?
Reads Retry-After in either of its forms: delta-seconds or an HTTP date.
verifyWebhook({required Object rawBody, required Map<String, String> headers, required String secret, Duration tolerance = webhookSignatureTolerance, DateTime? now}) → WebhookEnvelope
Checks a webhook delivery's signature and returns its envelope.

Exceptions / Errors

FoPostAuthenticationException
A 401 — the API key is missing, invalid, or expired.
FoPostConnectionException
The request never reached the API: a socket error, a DNS failure, or the per-request timeout running out.
FoPostException
The base class for everything this SDK throws.
FoPostFileTooLargeException
A 413 — a file is over the account's upload ceiling. The body carries max_file_bytes, file_bytes and upgrade_url.
FoPostNotFoundException
A 404 — no such resource, or it is outside the key's reach.
FoPostPaymentRequiredException
A 402 — no active subscription, or AI credits are exhausted.
FoPostPermissionDeniedException
A 403 — the key is valid but lacks the scope or workspace access.
FoPostRateLimitException
A 429 — over the plan's per-minute ceiling.
FoPostServerException
A 5xx — the API failed to handle the request.
FoPostValidationException
A 400 or 422 — the request body did not pass validation.
FoPostWebhookSignatureException
A delivery whose signature did not check out.