How I Accidentally Built an API Business

Laptop and code

What do Stripe, Twilio, Algolia and Currencycloud have in common? They‘re all API-first businesses that make it easy for developers to integrate complex functionality into any application with a few lines of code.

By productizing a service into a well-designed API, you can build a highly scalable and profitable software business without the overhead of traditional SaaS products. APIs are eaten by code rather than clicking through a user interface.

I know this because a few years ago, I accidentally built an API business myself. Here‘s the story of how it happened.

Scratching my own itch

It started as a quick hack. I was building an app that lets users save and categorize their favorite quotes. To make it more engaging, I wanted to display a random famous quote as placeholder text in the form fields.

After googling for a public API to fetch random quotes, I was surprised that I couldn‘t find an easy-to-use, well-documented quotes API. There were a few open databases of quotes, but they required downloading huge text files and hosting them myself.

So I decided to build my own API. I already had experience setting up a web server and database for my app, so it was straightforward to expose that data through a REST API.

In a couple hours, I had a simple /random endpoint that returned a random quote as JSON:

{
  "text": "Be yourself; everyone else is already taken.",
  "author": "Oscar Wilde" 
}

Oscar Wilde quote

I plugged this API into my quotes app, and it worked great! On a whim, I posted the API documentation on GitHub to see if anyone else might find it useful.

Launching an MVP

To my surprise, the quotes API started getting some attention. Fellow developers were starring the repo and even opening pull requests to add more quotes. Some folks asked if they could use the API in their own apps.

At first, I was thrilled that something I made was valuable to others. So I decide to productize it a bit more, to see where it would lead.

I registered the domain api.quotable.io and set up a landing page with documentation. To handle increased traffic, I moved the API to a dedicated server and put CloudFlare in front as a caching layer.

API documentation

To fund the hosting costs, I put up a donation button. Within a month, I had enough to cover my expenses. That‘s when I realized this API could be a real business.

Iterating based on feedback

Developers started using the quotes API for all sorts of creative use cases:

  • Generating placeholder text for design mockups
  • Displaying random quotes in the footer of a website
  • Powering a quotes widget on a new tab browser extension
  • Seeding funny chat bots that auto-respond with witty remarks

Based on feature requests and feedback from users, I expanded the API with more endpoints:

  • GET /quotes to fetch multiple quotes with filtering and pagination
  • GET /authors to get a list of all the authors and their quotes
  • GET /tags to browse quotes by category like "love", "success", "humor"

Feedback box and survey

I also improved the developer experience:

  • Interactive API explorer to try out requests without leaving the docs
  • Wrappers and SDKs for popular languages like Python, JS, Ruby
  • A changelog and status page to notify users of updates and downtime
  • Email support with guaranteed response times for paying customers

By listening closely to developers‘ needs and rapidly shipping enhancements, the quotes API became a delight to use. Word of mouth continued to grow the user base.

Technical architecture

Let‘s take a peek under the hood at the tech powering this API. It‘s a lightweight stack designed for performance, flexibility, and iteration speed.

Server racks

The data layer is a PostgreSQL database with tables for quotes, authors, and tags. Redun indexes this data into Solr for full-text search so queries are fast.

For the application layer, I chose Django because of its maturity, extensive ecosystem, and first-class REST framework integration. The API views are simple functions that validate input, query the database, and serialize the response.

To scale the API servers horizontally, I use AWS Application Load Balancer to distribute traffic evenly. Gunicorn runs the Django app with multiple worker processes.

I lean heavily on Datadog for metrics, traces, and logs across the entire stack. Having deep visibility is critical for diagnosing production issues quickly. Sentry captures errors in real-time.

Finally, Stripe handles billing and subscriptions for the metered API plans. Their APIs and documentation are a gold standard I strive to emulate.

Operational excellence

Operating a production API with paying customers requires a high bar for reliability, security, and support. A few practices help maintain this:

End-to-end smoke tests run on a cron job to proactively detect issues with critical functionality. Integration tests cover the core API contracts and responses. Load testing reveals performance bottlenecks before they cause outages.

Continuous deployment pipelines automatically run tests, provision infrastructure, and release code to production after every merge to master. Rolling deploys allow reverting bad changes with minimal downtime.

Fine-grained access controls and audit logging secure the data. Encryption at rest and in transit with SSL. Penetration tests by a third party uncovered vulnerabilities.

Internal dashboards and tools streamline common customer support workflows, like provisioning API keys, checking usage stats, issuing refunds.

Support team

Empowering the small support team to resolve issues without escalating to engineering was a force multiplier. Investing in tools and documentation that enabled them to be productive made customers happy.

Lessons learned

Building Quotable taught me valuable lessons about running an API business:

Pricing is hard. After many iterations, I settled on usage-based pricing with a generous free tier, to encourage adoption. Aligning price with value for each customer segment took lots of customer development work.

Documentation is a key differentiator. Developers will switch to a competing service if integrating your API is painful. Invest in delightful documentation that‘s always up-to-date, provides sample code, and includes step-by-step tutorials.

Manage support expectations. No matter how reliable your infrastructure, things will break. Have a plan for responding to unplanned incidents. Be transparent with post-mortems that explain root causes and steps to prevent similar failures.

Think like a product manager. Roadmapping, prioritization, and execution velocity determines the trajectory of your API platform. Saying no and avoiding scope creep is necessary to maintain focus.

Reflections

What started as a fun side project to solve my own need grew organically into a profitable SaaS business. Although I didn‘t have a grand vision from the beginning, consistently delivering value to users and gathering their feedback revealed a path forward.

APIs are powerful because they enable new functionality to be built by composing existing building blocks. I‘m excited to see more developers launch their own niche API products to make a piece of the software stack more accessible.

As for the quotes API, it still doesn‘t have a formal name and exists under my personal brand. Perhaps someday I‘ll spin it out into its own company. For now, I‘m content knowing that it helps developers ship faster while generating passive income.

Looking ahead, I‘m exploring ideas for new APIs in the data enrichment and integration space. The beauty of an API business is you can validate ideas quickly with an MVP to test the market. I hope this inspires you to productize your own creations into APIs. You may even accidentally build a business!

Let me know what APIs you‘re excited about at [email protected]. You can also follow along on my blog where I share more adventures in software and entrepreneurship.

Similar Posts