For B2B platforms, your API is your product. Not a feature, not an add-on: the product itself. Your customers' developers will spend more time with your API documentation than with your marketing website. A well-designed API reduces integration time from weeks to days. A poorly designed one becomes the reason customers choose your competitor.
The best B2B APIs share three qualities: they are predictable (developers can guess how an endpoint works before reading the docs), they are forgiving (reasonable defaults, helpful error messages, graceful handling of edge cases), and they are stable (changes do not break existing integrations).
Follow these conventions and your support team will thank you:
Authentication: Use API keys for server-to-server integrations and OAuth 2.0 for user-context integrations. API keys should be passed in the Authorization header, not as query parameters (query params end up in server logs). Provide separate keys for test and production environments.
Versioning: Version your API from day one. The two common approaches are URL versioning (/v1/users) and header versioning (Accept: application/vnd.api+json;version=1). URL versioning is simpler and what most developers expect.
When you release a breaking change, maintain the old version for at least 12 months. Send deprecation notices via email and API response headers (Deprecation: true). Breaking changes with no warning will cost you customers.
Your API documentation needs four things:
Host your docs on a fast, searchable site. Stripe's documentation is the gold standard: clean, searchable, with working code examples in multiple languages. You do not need to build something that elaborate, but study it for inspiration.
REST for most B2B use cases. It is simpler, more widely understood, and easier to cache. GraphQL works well when clients need to fetch deeply nested data in a single request, like mobile apps. If in doubt, start with REST.
Set limits per API key, not per IP. Return 429 status codes with a Retry-After header. Start with generous limits (1,000 requests/minute) and tighten based on actual usage. Provide higher limits for paying customers.
As rarely as possible. Non-breaking changes (adding fields, adding endpoints) do not need a new version. New versions only for breaking changes. Most well-designed APIs release a new major version every 2-3 years.
Lavoriamo con aziende in tutta Europa su progetti di software development projects. Raccontaci a cosa stai lavorando.
Contattaci