Skip to main content
When you authorize an ad platform such as Meta or TikTok, Apostra reads the ad accounts that sign-in can reach. Those accounts are what you map your advertisers to, so a connection is not ready to buy through until the read works. If the read fails, the connection shows error, and it now also says why and who can fix it. You or your agent no longer have to guess whether to reconnect.

Where to read it

Read accountDiscovery on a connection with get or search using kind: "connection" (see the quickstart for connecting an agent). A seller read carries the same fact for its connection at connectionState.accountDiscovery. The Connections page uses it to decide whether to offer Reconnect.
accountDiscovery describes the connection’s latest read of its ad accounts, so a later successful read replaces an earlier failure. It is null until the first read, and also while the connection’s sign-in has expired or been revoked, because that is the problem to fix first. After a successful read, state is succeeded and reason, resolvedBy, and failedAt are null.

Who can fix it

resolvedBy names who can fix a failed read. Apostra decides it from the reason. Show it as it is, and do not work it out again on your side.

The reasons

failedAt is when the failed read happened. It is null for a failure recorded before Apostra kept the time.

Reconnecting

Reconnect only when resolvedBy is buyer, or when the connection is in error with no failed read. A connection can also be in error because its sign-in expired or was revoked, and connecting again fixes that. Reconnecting targets the connection you already have. Pass its connectionId to save_connection so the new sign-in replaces the broken one instead of creating a second connection. See Connecting ad platform accounts for how to authorize each platform.