API Status Get API Key

Agent Setup

Follow this guide only when the user explicitly asks to set up or verify Buffer public API access. When they do, start the steps below rather than only acknowledging or summarizing them.

Safety boundaries

  • Do not ask the user to paste their API key into the chat.
  • Read the key only from the BUFFER_API_KEY environment variable.
  • Never print, log, or commit the key. Check whether the variable is set without displaying its value.
  • If you cannot read environment variables, say so and stop.
  • If BUFFER_API_KEY is unset or empty, briefly say that it must be made available securely in the agent's environment before setup can continue, then stop.
  • Make only read-only requests during this setup. Get the user's explicit approval before every GraphQL mutation or other state-changing request. After listing the channels, stop.
  • Use only direct requests to Buffer's public API. Do not substitute another tool or integration.

Request format

Buffer's API uses GraphQL at https://api.buffer.com. Every request is a POST with:

  • Content-Type: application/json
  • Authorization: Bearer $BUFFER_API_KEY
  • A JSON body containing {"query":"..."} and "variables" when the query uses variables

Keep the Authorization header value out of all output.

Setup steps

  1. Confirm that you can read environment variables and that BUFFER_API_KEY is set, following the safety boundaries above.
  2. Read any available Buffer llms.txt, Quick Start, Authentication, and Your First Post pages for background. Treat this page as authoritative for this setup.
  3. Verify access by sending this query, then show the user the API response:
query GetOrganizations {
  account {
    organizations {
      id
      name
    }
  }
}

If the request fails, briefly report the error without including the request headers or API key, then stop.

  1. Show the returned organizations and ask the user which one to use. Do not choose for them.
  2. List the selected organization's channels with this query, passing its ID as the organizationId variable:
query GetChannels($organizationId: OrganizationId!) {
  channels(input: { organizationId: $organizationId }) {
    id
    name
    service
  }
}
{
  "organizationId": "the_selected_organization_id"
}

Show the result, then stop. Get the user's explicit approval before every GraphQL mutation or other state-changing request.