Developer Docs

We created the Kiva API so that anyone with a good idea and some software savvy can help us expand the reach of Kiva, taking it into new environments and to new audiences, and creating new features for the Kiva community to experience our content in new ways. True to the name of our developer destination, we want you to help us build Kiva.org.

API Spotlight

In order to make the API as fast, usable, and mobile-friendly as possible we decided to use GraphQL. One of the great things about GraphQL is it's self documenting so you can easily explore all the functionality by going to the GraphiQL Explorer. Click on the "Docs" link in the top right corner to open the Documentation Explorer. Click the "play" button to run the query you build. The GraphiQL Explorer allows you to practice writing queries and viewing the returned results. Try it out!

GraphQL Samples

Javascript: POST Method
Python 3: GET request
Python 3: POST request
CURL: GET method
CURL: POST method
fetch('https://gateway.production.kiva.org/graphql', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ query: "{lend {loan (id: 1568001){id name}}}" }),
})
  .then(res => res.json())
  .then(res => console.log(res.data));

NOTE: QraphQL's limit for a GET request query is 2500 characters. A POST request is recommended for longer queries

With all the methods above, the successfully returned JSON data should look something like:

{'data': {'lend': {'loan': {'id': 1568001,
			   'name': 'Leydi'} } } }

For more information on GraphQL itself, and how to write queries, please check out these docs