Open Collective

Open Collective

Social

Platform where communities can collect and disburse money transparently to sustain themselves and develop their activities. Community is about trust and sharing. Open Collective lets you manage your finances so everyone can see where money comes from and where it goes.

Visit API

📚 Documentation & Examples

Everything you need to integrate with Open Collective

🚀 Quick Start Examples

Open Collective Javascript Examplejavascript
// Open Collective API Example
const response = await fetch('https://docs.opencollective.com/help/developers/api', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

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

Open Collective API Documentation

Open Collective is a platform that helps groups raise funds and manage expenses transparently by creating a community around a shared cause. The Open Collective API is public and allows developers to build applications on top of the Open Collective platform.

Getting Started

To get started with using the Open Collective API, you first need to obtain an API key. You can obtain an API key by creating an account on the Open Collective website.

The base URL for all API endpoints is https://api.opencollective.com/. All API requests require authentication using your API key.

To authenticate requests, set the Authorization header to Bearer [API Key] where [API Key] is your API key.

Examples

Here are some example API requests in JavaScript:

Get all collectives

async function getAllCollectives() {
  const url = "https://api.opencollective.com/graphql/v2";
  const query = `{
    allCollectives {
      nodes {
        id
        slug
        name
        currency
        balance
      }
    }
  }`;
  
  const options = {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${api_key}`,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({ query })
  }
  
  const response = await fetch(url, options);
  const data = await response.json();
  return data.data.allCollectives.nodes;
}

Create a donation

async function createDonation(collectiveSlug, amount, interval = "one-time") {
  const url = `https://api.opencollective.com/${collectiveSlug}/donations`;
  
  const options = {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${api_key}`,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      donation: {
        amount,
        interval
      }
    })
  }
  
  const response = await fetch(url, options);
  const data = await response.json();
  return data;
}

Get all expenses for a collective

async function getAllExpenses(collectiveSlug) {
  const url = `https://api.opencollective.com/${collectiveSlug}/expenses`;
  
  const options = {
    headers: {
      "Authorization": `Bearer ${api_key}`
    }
  }
  
  const response = await fetch(url, options);
  const data = await response.json();
  return data;
}

Conclusion

In this blog post, we have covered some basic examples of using the Open Collective API in JavaScript. The examples covered here should be enough to get you started with building applications on top of the Open Collective platform. For more information, check out the official Open Collective API documentation.

📊 30-Day Uptime History

Daily uptime tracking showing online vs offline minutes

Jul 1Jul 3Jul 5Jul 7Jul 9Jul 11Jul 13Jul 15Jul 17Jul 19Jul 21Jul 23Jul 25Jul 27Jul 3004008001440Minutes
Online
Offline

Related APIs in Social