A partner API that businesses can join on their own

The backend that lets partner businesses subscribe, pay, and connect their own systems to KiriminAja, without a manual approval before they can test.

Problem

Partner businesses connect their own systems to the KiriminAja API. Before this work, each partner went through onboarding with the KiriminAja team. A partner also needed an approval before they got access to the sandbox, a test environment.

The goal was self-service. A partner picks a plan, pays, gets credentials, and starts to send requests. Each request must meet a set of conditions before it reaches the systems behind the API.

Constraints

Partners use more than one kind of credential. Each partner tests in the sandbox before production, and each environment has its own list of allowed IP addresses.

What I did

I was the primary backend implementer, with about 80 pull requests across six services. The work covered subscription plans and their payment, API keys that partners create themselves, and a new version of request authentication. It also covered the lists of allowed IP addresses. I also made the middleware, the code that runs before each request, the same across these services.

Decisions

  • Authentication first finds out which kind of credential a request uses. Then it makes sure that the credential is valid for that kind.
  • A valid credential is not enough. The request must belong to the partner, the partner must be active, the IP address must be on the list, and the plan must cover the call.
  • The sandbox and production stay separate. Each one has its own list of allowed IP addresses.

Result

The integration is in production. Partners no longer wait for an approval before they test in the sandbox. The work also gave KiriminAja a new source of revenue from subscription fees.

Next time

The hardest part was to understand what the business expected and to turn it into a technical specification. The data model was hard for the same reason. I was not able to design the tables from best practice alone, because they also had to support the data that already existed.

One thing that I want to change is the number of credential kinds. Partners use more than one kind today. My preferred design is one kind of API key for all partners.

Work across six services taught me that a balanced design, one that also plans for the future, pays off later. It is the same lesson as "slow down to go faster."