APIs and microservices
Last updated Apr 24, 2026 Build, secure, and manage Application Programming Interfaces (APIs) with rate limiting, authentication, and observability. Cloudflare Workers deploys API handlers globally with automatic scaling. API Shield validates requests against your OpenAPI specification. Rate Limiting prevents abuse. mTLS authenticates machine-to-machine communication. Cloudflare Tunnel and Access secure internal microservices. Logpush and Workers Analytics Engine provide monitoring.
Architecture patterns
Secure API gateway
Protect your APIs with defense in depth:
- API Shield validates requests against your OpenAPI schema
- Security rules managed rulesets block SQL injection, XSS, and OWASP Top 10 vulnerabilities
- Rate Limiting prevents abuse and Distributed Denial of Service (DDoS) attacks
- mTLS (mutual TLS) authenticates known clients with certificates
Edge-native APIs
Build APIs that run entirely on Cloudflare:
- Workers handles request routing and business logic
- D1 or KV stores application data
- Queues handles async processing and webhooks
Microservices mesh
Connect and secure internal services:
- Cloudflare Tunnel exposes services without public IPs
- Access enforces identity-based policies between services
- Workers acts as an API gateway for external consumers
Prerequisites
Create a new application
- A Cloudflare account ↗︎.
- Node.js ↗︎ (version 16.17.0 or later) installed on your machine.
- Wrangler installed.
Use an existing application
- A Cloudflare account ↗︎.
- A domain added to Cloudflare with DNS records proxied through Cloudflare. This is required for API Shield, rate limiting, and application security.
- For securing internal services with Cloudflare Tunnel and Access: a Cloudflare One organization created in the Cloudflare dashboard.
Related resources
API Shield documentation
Complete documentation for API discovery, schema validation, and security.
Workers examples
Code examples for building APIs with Workers.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"WebPage","@id":"https://developers.cloudflare.com/use-cases/apis/#page","headline":"APIs and microservices","description":"Build, protect, and monitor APIs with Cloudflare Workers, API Shield, rate limiting, mTLS, and Logpush.","url":"https://developers.cloudflare.com/use-cases/apis/","inLanguage":"en","image":"https://developers.cloudflare.com/use-cases/apis/og.png?v=94d9da93d006ac85","dateModified":"2026-04-24","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Deploy globally distributed APIs that scale automatically with no servers to manage. title: Deploy APIs at the edge image: https://developers.cloudflare.com/use-cases/apis/deploy-apis/og.png?v=b5b4850e592b4208
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/use-cases/llms.txt
Use this file to discover all available pages before exploring further.
Docs