POST input to a Serverless Function

Hello all. Following the documentation on Serverless Functions, it is demonstrated how to pass over input arguments into the function handler (the ‘args’ for the ‘main()’ function. It is shown and explained that the parameters can be passed as query strings (i.e. GET method) and retrieved in the handler using the ‘args’ object. Is there a way to also pass such input parameters using POST? For instance, listening to PayPal webhook require POST acceptance. Also, passing over a large base64 input (image/audio) does not make sense as a GET parameter. How can these be accepted and retrieved within the main(args) handler, both for a web function as well as internal call. Thanks!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
March 6, 2024


Yes, that should be doable as described here:

  • web: true: This is the default mode. Query string parameters and the request body are parsed and added as top-level keys in the event dictionary.
  • web: raw: The HTTP request body and query string are included as-is instead of being parsed.
  • web: false: No web event is included at all.

The default web: true event is structured like the following JSON example:

  "http": {
    "headers": {
      "accept": String,
      "accept-encoding": String,
      "content-type": String,
      "user-agent": String,
      "x-forwarded-for": String,
      "x-forwarded-proto": String,
      "x-request-id": String
    "method": String,
    "path": String
  [String]: any

Let me know how it goes!



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel