Finding an operation
The schema is authoritative for the supported GraphQL subset: operation roots, names, arguments, input types, and enum values. Descriptions provide usage guidance, and the GraphQL Explorer exposes both. For REST-only capabilities, use the REST API reference. Operation names follow the REST endpoints they reach, in camelCase.GET /history is postHistory, GET /analytics/social is socialAnalytics, POST /post is createPost.
Queries read, mutations write
Queries are reads and validations that change nothing on our side. Mutations publish or change state, start work, or send email. Neither the REST HTTP verb nor the cost of a call decides the root:validatePostchecks a post without publishing it.validateMediachecks that a media URL is reachable.generatePostis a query because nothing on our side changes. It still counts as an API call and returns different text each time, so make sure a client cache or automatic refetch does not repeat it without you noticing.mediaUploadUrlis a mutation because it creates an upload URL for your account.linkAnalyticsis a mutation because it can request an emailed report.userBatchis a mutation because it starts an export job.
Creating a post
createPost takes a single input argument, so the whole post is one object:
Argument types
Most arguments are ordinary strings, numbers and booleans. Three cases are worth knowing about.Enums
Many string arguments with a closed supported set are GraphQL enums, written unquoted and upper case:"instagram". The server maps each accepted enum to the exact value expected by the underlying REST controller — often, but not always, a lowercase string. An invalid enum is rejected during GraphQL validation before the operation runs, so a typo costs you nothing.
Some arguments share a name across operations but accept different values, because the endpoints genuinely differ. reviews(platform:) accepts only GMB and FACEBOOK, since those are the only networks with reviews. Your client’s autocomplete will show the correct set for each operation.
The JSON scalar
A few arguments are typed asJSON rather than a specific type. This happens where a value legitimately has more than one shape and no single GraphQL type could describe it honestly:
explainError(code:)accepts215or“215”, because customers hold error codes as both.createPost(input:)uses JSON for fields such aspostandmediaUrls, which can be shared values or per-platform objects.createAutomation(triggers:, actions:)take arrays whose fields depend on each entry’stype.boostFacebookPost(interests:)accepts Meta interest ids as strings or numbers.
JSON argument is not a loophole: the resolver validates it before dispatch, so an invalid value returns a validation error and consumes no API call.
Optional arguments and nulls
For optional arguments and optional fields inside input objects, explicitnull is normalized to omission. Null members inside lists are preserved when the list type permits them.
Reading responses
Most operations return aJSON scalar containing the complete REST response envelope, so select the root field without subfields. createPost currently returns a typed PostResult, so select its fields:
PostResult also include raw: JSON!, containing the complete unmodified REST response:
raw is permanent and is there so a new field appearing in the REST response is never unreachable from GraphQL while we catch up on typing it. If you need something the typed fields do not expose, ask for raw.
Uploading media
Media bytes cannot travel through a GraphQL request. A GraphQL request is a single JSON document under a 64 KB limit, so there is no field that accepts a file, and encoding an image as base64 inside the query would exceed that limit for anything larger than a thumbnail. The supported path avoids the problem entirely, and is faster than uploading through an API in any case, because your bytes go straight to storage:-
Ask for an upload URL:
-
Read
data.mediaUploadUrl.uploadUrl,accessUrl, andcontentTypefrom the returned JSON. -
PUTyour file directly touploadUrl, not to the Ayrshare API, setting the request’sContent-Typeheader to the returnedcontentType. -
After the upload succeeds, pass
accessUrlincreatePost.input.mediaUrls:
uploadUrl as a short-lived write credential and do not log or expose it. accessUrl is the media URL used when creating the post.
You can also keep using the REST upload endpoints and reference the resulting URLs from GraphQL. The two interfaces share the same media library.
Read next
- Errors — HTTP status codes, error shapes, and partial success.
- Limits and Billing — query size caps and how requests are counted.