Serverless APIs and Webhooks: HTTP Functions for Small Teams

Key Takeaways

A serverless API maps HTTP requests to bounded function execution instead of a continuously managed app process. Raff Functions provides HTTP live URLs, standard handlers, autoscaling, logs, metrics, and scale-to-zero. Webhook-specific retries and security belong in dedicated guides, while this connector owns the broader HTTP runtime decision.

Serdar Tekin
Serdar Tekin
Co-Founder & CTO
Updated 14 min read
Written for: Developers choosing serverless HTTP Functions for APIs, webhooks, callbacks, and event-driven endpoints
Serverless FunctionsAPIsHTTPWebhooks
Last reviewed:
Guide
Serverless APIs and Webhooks: HTTP Functions for Small Teams
rafftechnologies.com/learn

Receive webhooks on a function with its own HTTPS URL.

Deploy code without a server, billed per second of use, with a free allowance every month.

A serverless API is an HTTP endpoint whose application logic runs as on-demand functions instead of a continuously managed application server.

That model fits small teams when HTTP work is bounded, independently deployable, and able to keep durable state outside the function. The same HTTP function can serve a small API route, receive a webhook, handle a callback, or expose a lightweight internal endpoint without requiring the team to operate a full web server for that task.

The important decision is not whether HTTP is "serverless." It is whether the request can be handled as a clear unit of work. A webhook that validates a signature, records an event, and returns is function-shaped. A large application with many routes, long-lived connections, shared in-process state, and constant traffic may fit a persistent app runtime better.

At Raff, we use HTTP Functions as an event boundary: receive the request, authenticate or validate it, perform bounded work, write durable state, and return. This guide maps that operating model. The deeper implementation topics—webhook retries, API authentication, CORS, rate limiting, and choosing Function URLs versus an App Platform API—belong to their dedicated guides.

Serverless APIs turn HTTP requests into function invocations

A traditional application server stays running and listens for requests continuously. A serverless API maps incoming HTTP traffic to function execution.

Text
Client / external service ↓ HTTPS URL ↓ HTTP Function ↓ Database / Object Storage / external API ↓ Response

The HTTP interface can still look like a normal API. Clients do not need to know whether the code behind the endpoint runs on a function, container, VM, or another compute model.

The difference is operational:

AreaServerless HTTP functionPersistent app runtime
LifecycleRuns from incoming demandProcess stays running
ScalingFunction instances scale with loadApp replicas or servers scale
Idle capacityCan scale down aggressivelyDepends on app platform/runtime
OS/process managementMostly platform-ownedMore runtime ownership
StateShould be external/durableCan reuse process state, but durable data still external
Best fitBounded endpoints and event receiversLarger persistent applications

A serverless API is therefore not a different HTTP protocol. It is a different execution model behind the HTTP boundary.

The Serverless vs Containers guide owns the broader lifecycle decision. This guide focuses specifically on HTTP APIs and webhooks built from functions.

HTTP APIs fit when requests are bounded and independent

A serverless HTTP endpoint is strongest when one request can be understood and completed independently.

Good candidates include:

  • small REST-style endpoints;
  • form submissions;
  • API callbacks;
  • webhook receivers;
  • internal utility endpoints;
  • lightweight authorization callbacks;
  • metadata lookups;
  • short data transforms;
  • status-update endpoints;
  • endpoints that trigger asynchronous work;
  • low or irregular traffic APIs.

The common shape is:

Text
request arrives ↓ validate/authenticate ↓ perform bounded work ↓ write durable state if needed ↓ return response

This works especially well when endpoints have different traffic patterns. A billing webhook, image callback, and internal admin endpoint do not need to share the same scaling profile simply because they belong to one product.

A function also creates a useful isolation boundary. External webhook retries or traffic spikes do not need to compete directly with the main application process.

However, splitting every route into a separate function is not automatically better. Each deployment unit adds configuration, ownership, logs, secrets, and failure modes. Keep related routes together when that makes the application easier to operate.

Webhooks are a specialized HTTP API workload

A webhook is an HTTP request sent by another system to tell your application that an event occurred.

Examples include:

  • payment succeeded;
  • subscription changed;
  • Git event occurred;
  • email bounced;
  • CRM record changed;
  • form was submitted;
  • monitoring alert fired;
  • document was signed.

Because webhooks are event-driven, they are a natural serverless workload. But webhook correctness requires more than exposing a URL.

A safe high-level flow is:

Text
provider request ↓ validate sender/signature ↓ check duplicate event ↓ store durable event state ↓ acknowledge quickly ↓ process slow work separately

This connector guide deliberately does not own the detailed retry, signature, idempotency, replay, and durable-event design. Those belong to Webhooks on Serverless Functions.

The ownership boundary matters for SEO and for readers: this page explains where HTTP Functions fit; the webhook guide explains how to operate a webhook endpoint safely.

API state should live outside the function runtime

Serverless HTTP code should not depend on one execution environment surviving for the next request.

Durable state belongs in services designed to persist it:

  • user and application records → database;
  • sessions or durable tokens → appropriate persistent store;
  • uploaded files and generated artifacts → object storage;
  • job status → database;
  • secrets → environment or secret management;
  • long-running workflow state → database, queue, or workflow system.

A safe pattern looks like this:

Text
HTTP Function ↓ Managed Database = durable records Object Storage = files/artifacts External API = third-party action

Warm execution environments may let code reuse initialized clients or connection pools temporarily, but correctness should never depend on that reuse.

This is one of the strongest architecture tests for serverless APIs: if the endpoint only works when local process state survives between requests, it is not cleanly function-shaped.

Authentication, CORS, and rate limiting are separate API controls

Putting an API behind a function does not remove normal HTTP security requirements.

Production endpoints still need decisions around:

  • authentication and authorization;
  • CORS policy;
  • rate limiting or abuse controls;
  • request size and validation;
  • secret handling;
  • logging sensitivity;
  • tenant isolation;
  • replay protection where relevant;
  • API versioning;
  • error behavior.

These controls should be designed per endpoint family. A public webhook receiver, browser-facing API, and internal service endpoint have different trust boundaries.

The roadmap's dedicated Serverless API Authentication, CORS, and Rate Limiting guide owns those controls in depth. This connector keeps them visible as architectural requirements without duplicating that future article.

A useful rule is: serverless changes who operates the runtime; it does not remove the responsibilities of an Internet-facing API.

Function URLs work best when the HTTP surface stays simple

A direct function URL can be a clean interface when a team needs one bounded HTTP service without a large routing layer.

Good examples include:

  • one webhook receiver;
  • one callback endpoint;
  • a small internal API;
  • a narrow public endpoint;
  • a lightweight microservice with a few related routes.

As the HTTP surface grows, the decision becomes broader. Teams may want a persistent application runtime when they need:

  • many tightly coupled routes;
  • long-lived connections;
  • extensive middleware;
  • shared in-process caches;
  • complex routing behavior;
  • a continuously busy API;
  • several coordinated background processes;
  • a full application framework running as one service.

That next decision belongs to the planned Function URLs vs App Platform APIs guide. The point here is to avoid treating every HTTP endpoint as either "must be a function" or "must be a full app." The right boundary follows workload shape.

Serverless APIs still need latency and concurrency planning

HTTP functions can scale independently, but that scaling can move pressure downstream.

A burst of API requests may create more simultaneous:

  • database connections;
  • external API calls;
  • object-storage operations;
  • authentication checks;
  • queue writes.

The function platform being able to scale does not prove every dependency can absorb that scale.

Use a capacity chain:

Text
incoming HTTP traffic ↓ function scale/concurrency ↓ database / API / storage capacity

For latency-sensitive endpoints, cold-start behavior may also matter. Raff Functions supports scale-to-zero and optional warm capacity, so teams can choose between avoiding idle capacity and keeping latency-sensitive execution ready.

The Cold Starts, Concurrency, and Scale-to-Zero guide owns startup behavior. The Runtime Limits guide owns hard timeout and capacity limits. This page only establishes that HTTP API design must account for both.

Raff Functions provides a direct HTTP runtime

Raff Functions supports HTTP live URLs with automatic TLS, alongside cron, one-off, and object-storage triggers. HTTP code can use standard handler patterns including Python FastAPI/ASGI, Node.js standard HTTP, JavaScript Web Fetch, TypeScript, and Go net/http, with a Dockerfile escape hatch for custom runtimes.

That matters for API portability. The application can look like normal HTTP code rather than depending on a Raff-specific request/response signature.

Current Raff Functions also provides:

  • scale-to-zero and load-based autoscaling;
  • editable runtime settings;
  • logs and metrics for invocations;
  • live log tail;
  • invocation count, p50, p95, and error-rate visibility;
  • timeouts up to 1 hour by default and up to 24 hours on request;
  • bindings to managed databases and object storage;
  • a per-account spend cap that is on by default.

Those characteristics make HTTP Functions useful for small APIs and event receivers that need to run independently without the team operating a full server just for the endpoint.

For an actual first deployment path, use Deploy an HTTP Function on Raff. That example verifies an HTTP response and logs; production authentication, webhook signatures, and rate limits need separate controls.

They do not mean every API should become a function. A continuously busy application with a broad HTTP surface may be easier to operate as a persistent app or container runtime. Compare the ownership and release tradeoffs in Serverless API Endpoint vs App Platform.

Compare Raff Functions with persistent compute after deciding whether your HTTP workload is bounded and event-driven.

Choose the HTTP runtime by request and application shape

Use this framework before deployment:

HTTP workloadBetter starting pointWhy
Payment webhookFunctionEvent-driven and isolated
Git/CRM/email webhookFunctionIrregular external callbacks
Small internal utility APIFunctionNarrow bounded HTTP work
Low-traffic public endpointFunctionCan benefit from scale-to-zero
Endpoint that starts background workFunctionAcknowledges and hands off bounded work
Large application with many coupled routesPersistent app runtimeShared app lifecycle is clearer
WebSocket/long-lived connection servicePersistent app runtimeConnection lifecycle matters
Always-busy APICompare bothLittle idle time reduces scale-to-zero advantage
API needing custom runtime but bounded requestsFunction with Dockerfile may fitKeeps event lifecycle with custom environment
App plus several webhooksMixedPersistent app + isolated webhook functions

Then ask:

  1. Can one request complete as a bounded unit of work?
  2. Can durable state live outside the execution environment?
  3. Can the endpoint tolerate the function runtime limits and startup model?
  4. Does independent scaling simplify operations?
  5. Is the HTTP surface still small enough that function-level ownership remains clear?

If the answers are mostly yes, a serverless API is a strong starting point.

HTTP Functions should create a clean event boundary

Serverless APIs work best when HTTP requests map cleanly to bounded application work.

Use Functions for webhooks, callbacks, small APIs, and narrow endpoints that should scale independently and avoid idle server ownership. Keep durable records in a database and files in object storage. Treat authentication, CORS, rate limiting, retries, and downstream capacity as production concerns rather than features the serverless label solves automatically.

For Raff teams, HTTP Functions provide standard handlers, TLS URLs, autoscaling, logs, metrics, and a path to custom Dockerfile runtimes. Keep the main application on a persistent runtime when its process needs to stay alive, and use Functions where an HTTP event should start and finish independently.

Sources

Was this article helpful?
Serdar Tekin
Serdar Tekin
Co-Founder & CTO

Co-Founder & CTO at Raff, focused on cloud infrastructure, systems architecture, security, reliability, and production operations.

Receive webhooks on a function with its own HTTPS URL.

Deploy code without a server, billed per second of use, with a free allowance every month.

14-day money-back guarantee

Frequently asked questions

What is a serverless API?
A serverless API is an HTTP API whose application logic runs as on-demand functions rather than a continuously managed application server.
Are serverless functions good for APIs?
Yes when requests are bounded, independently scalable, and can keep durable state outside the function runtime. Large continuously busy applications may fit a persistent runtime better.
Are webhooks a good serverless use case?
Yes. Webhooks are event-driven HTTP requests and often fit functions well, especially when the endpoint validates, stores durable event state, acknowledges quickly, and moves slow work out of the request path.
Where should a serverless API store state?
Durable application records should live in a database and files or artifacts should live in object storage. Correctness should not depend on local function state surviving between requests.
Does a serverless API still need authentication and rate limiting?
Yes. Serverless changes the runtime operating model, not the security responsibilities of a public API. Authentication, authorization, CORS, validation, rate limiting, and abuse controls still need explicit design.
When should an API use a persistent app runtime instead?
A persistent app runtime can be clearer for many tightly coupled routes, long-lived connections, extensive middleware, shared process state, multi-process applications, or continuously busy traffic.
How does Raff support serverless HTTP APIs?
Raff Functions provides HTTP live URLs with automatic TLS, standard HTTP handler patterns, scale-to-zero, load-based autoscaling, logs, metrics, and a Dockerfile escape hatch for custom runtimes.