Authenticating with the GraphQL API

I’m looking to use the GraphQL API to deploy / manage infrastructure programatically. How do I authenticate with this API? Do I put a token generated by flyctl auth login in a header?

Hey Cory: You can find the docs here; tldr: Dashboard: Account → Settings → Access Tokens → Create Access Token.

Quick example of usage with httpie:

$ export FLY_API_TOKEN=<thing from dashboard>
$ https post https://api.fly.io/graphql query='query { viewer { email } }' Authorization:"Bearer $FLY_API_TOKEN"

{
    "data": {
        "viewer": {
            "email": "mik3y@example.com"
        }
    }
}

Thanks for that clarification!

Speaking of docs, I noticed in the graphql introspection docs that there are many fields of type JSON that don’t have any explanation as to what the JSON schema would be. Schemas related to “manifests”, Images, and Templates all have such fields. Are there more docs for them?