Skip to main content
The ads operations take the ads platform as an argument, so the same operation works on every ads platform Ayrshare supports. Today that is FACEBOOK and INSTAGRAM. Each operation calls the matching REST ads endpoint and returns its response unchanged. Authentication and limits are the same as REST. A failed call returns a GraphQL error: extensions.status carries the REST status, and extensions.code the Ayrshare error code when the REST error has one. See Errors. Ads operations need the Ads add-on. Without it, every call returns an error with extensions.status 403 and extensions.code 399.

Operations

Every operation also takes an optional profileKey to act on a User Profile. All of them return the REST response as JSON, so they take no field selection.

List ad accounts

Start here. Use the accountId values in the response wherever an operation asks for accountId.

Search targeting options

kind picks the search: INTERESTS for audience targeting, REGIONS or CITIES for locations. Each kind takes only its own arguments. For example, countryCode and regionId work only with CITIES, and INTERESTS needs search.

List ads

Pass at least one of campaignId, accountId, adId, postId or socialPostId. socialPostId is the network’s own post id, for posts not published through Ayrshare.

See what an ad has cost

Pause or resume an ad

updateAd changes real ad spend. PAUSED stops spending, ACTIVE resumes it, and DELETED or ARCHIVED retires the ad. The same status is also set on the ad’s ad set and campaign, so any other ads in that ad set or campaign change with it.
Boosting a post through these operations is coming. Until then, use boostFacebookPost or instagramBoostPost, or the REST boost endpoint for Facebook or Instagram.
The per-platform operations, such as facebookAdAccounts and instagramAds, still work and are unchanged.