⚡️ Getting started

Welcome Zenfi's developers portal.

Our Partners API is very limited at this moment but we move really fast and we would like to collaborate with you. Just, drop us a line: [email protected].

Who's this API for?

This API is currently intended for Partners, not Users. That means, we are not allowing programatic access for individual accounts. Instead we are focusing on:

  • Sending referrals (users) to commercial partners.
  • Making users registration process easier.
  • Collaboration with partners to bring users from their platforms to Zenfi.

GraphAPI

Our API uses GraphQL, we believe it provides clearer communication between us and our clients and makes building easier for developers. Hope you like it! 💜

Using the API

To start using Zenfi's API make sure you read the Authentication guide first, then you can start making request.

Zenfi uses a GraphQL protocol for its API. If really easy to get started, or check this guide if you are not familiar yet.

For example, make the following request to get data about the authorized developer (your account):

const url = 'https://api.zenfi.mx/partners/graphql';
const apiKey = 'MY_SECURE_API_KEY';

const query = `
  query {
    viewer {
      id
      name
    }
  }
`;

const response = await fetch(url, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${apiKey}`
  },
  body: JSON.stringify({
    query
  }),
});

console.log(await response.json());
require 'httparty'
require 'json'

@url = 'https://api.zenfi.mx/partners/graphql';
@apiKey = 'MY_SECURE_API_KEY';

@query = <<-GRAPHQL
  query {
    viewer {
      id
      name
    }
  }
GRAPHQL;

@result = HTTParty.post(@url,
  headers: {
    'Content-Type' => 'application/json',
    'Authorization' => "Bearer #{@apiKey}"
  },
  body: {
    query: @query
  }.to_json
);

puts(@result)

After you succeed with this request, you can check our full GraphAPI documentation here, or using any other recommended tool such GraphQL Playground or Apollo Studio, getting the schema from the introspection endpoint.

Environments

Our API has only one environment (yet).

Production:

  • Schema (no authentication required): GET https://api.zenfi.mx/partners/graphql/introspect.
  • GraphAPI: GET https://api.zenfi.mx/partners/graphql