API Status Get API Key

Quick Start

Buffer's API is built with GraphQL. If you're new to GraphQL, we'd recommend the official GraphQL documentation to get familiar with the basics before diving in.

Register for API Access

To get started with the Buffer API, you'll need a Buffer account and an API key. If you don't have an account yet, you can sign up here.

Once you have an account, head to API settings to create your API key.

What the API supports

Your API key lets you perform actions against your own Buffer account. We currently support the following operations:

  • Post Creation
  • Post Deletion
  • Post Retrieval
  • Idea Creation
  • Account Retrieval
  • Organization Retrieval
  • Channel Retrieval

Endpoint

The Buffer GraphQL API is available at:

https://api.buffer.com

If you'd like to use a tool like Postman or another HTTP client, point your requests to the endpoint above and follow Postman's GraphQL guide for setup.

Authorization

Every request must include an Authorization header with your API key using the Bearer format.

{
  "Authorization": "Bearer YOUR_TOKEN"
}
-H 'Authorization: Bearer YOUR_TOKEN'
headers: {
  'Authorization': 'Bearer YOUR_TOKEN',
}
CURLOPT_HTTPHEADER => [
    'Authorization: Bearer YOUR_TOKEN',
]

Making your first request

Here's a quick query to fetch your account and organization:

query GetOrganizations {
  account {
    organizations {
      id
    }
  }
}
curl -X POST 'https://api.buffer.com' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -d '{"query": "query GetOrganizations {\n  account {\n    organizations {\n      id\n    }\n  }\n}"}'
const response = await fetch('https://api.buffer.com', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_API_KEY',
  },
  body: JSON.stringify({
    query: `
    query GetOrganizations {
      account {
        organizations {
          id
        }
      }
    }
    `,
  }),
});

const data = await response.json();
console.log(data);
<?php

$query = '
query GetOrganizations {
  account {
    organizations {
      id
    }
  }
}
';

$payload = [
    'query' => $query,
];

$ch = curl_init('https://api.buffer.com');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'Authorization: Bearer YOUR_API_KEY',
    ],
    CURLOPT_POSTFIELDS => json_encode($payload),
    CURLOPT_RETURNTRANSFER => true,
]);

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
print_r($data);

Once you have your organization ID, you can use it to fetch channels, posts, and other data for that organization.