> Portal Navigation:
>
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt
## Resource: About Custom Site APIs
## Article: Exposing a Site API with HTTP Functions
## Article Link: https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/integrations/exposing-services/about-custom-site-apis.md
## Article Content:
# About Custom Site APIs
Custom site APIs allow you to expose your site's functionality externally.
This means that you, or other people, can access your site's functionality by calling your custom site APIs.
Write and export [HTTP functions](#http-functions) to define custom site APIs.
When you and others call the custom site APIs you defined, the corresponding HTTP function runs and the API responds with the HTTP function's return value.
Important:
Custom site APIs are only intended for use in server-to-server communications. For example, don't use custom site APIs to set a cookie on a site visitor's browser as you may no longer be in compliance with applicable data privacy regulations.
For example, you might use custom site APIs to:
- Integrate your site with an automation tool, such as [Zapier](https://zapier.com/) or [IFTTT](https://ifttt.com/).
- Receive notifications or information from external webhooks or services.
- Share a backend between your site and another application.
## Supported IDEs
You can write http functions using:
+ The [editor](https://dev.wix.com/docs/develop-websites/articles/workspace-tools/velo-workspace/workspaces/wix-studio-working-with-the-code-panel.md) (Wix Studio and Wix Editor).
+ The [Wix IDE](https://dev.wix.com/docs/develop-websites/articles/workspace-tools/velo-workspace/wix-ide/wix-studio-about-the-wix-ide.md) (Wix Studio).
+ Your [local IDE](https://dev.wix.com/docs/develop-websites/articles/workspace-tools/developer-tools/git-integration-wix-cli/about-git-integration-wix-cli.md) (Wix Studio and Wix Editor).
## HTTP functions
The main components of an HTTP function are:
- [HTTP method](#http-method)
- [Function name](#function-name)
- [Request parameter](#request-parameter)
- [Functionality](#functionality)
- [Response object](#response-object)
```js
export function _ (request) {
// functionality
return response;
}
```
### HTTP method
HTTP functions support the following HTTP methods:
- `GET`
- `POST`
- `PUT`
- `DELETE`
To learn more, see [Methods for HTTP Functions](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/integrations/exposing-services/methods-for-http-functions.md).
### Function name
The function name is the unique identifier for your HTTP function in your site. It is also used to identify the function in the custom site API call.
### Request parameter
The [request parameter](https://dev.wix.com/docs/velo/velo-only-apis/wix-http-functions/wix-http-function-request/introduction.md) is an object that is passed to the HTTP function. Use the request parameter for defining the details needed to process the HTTP function when it is called. The details generally include the request body, headers, URL, and other information.
For all supported properties, see [`WixHttpFunctionRequest`](https://dev.wix.com/docs/velo/velo-only-apis/wix-http-functions/wix-http-function-request/introduction.md).
### Functionality
Add code inside your HTTP function to run when your custom site API is called.
Inside your HTTP function, you have full access to the full range of [Velo](https://dev.wix.com/docs/velo.md) and [SDK](https://dev.wix.com/docs/sdk/articles/get-started/about-the-wix-java-script-sdk.md) APIs and you can import and call functions defined elsewhere on your site.
### Response object
Your HTTP function should return a [response object](https://dev.wix.com/docs/velo/velo-only-apis/wix-http-functions/wix-http-function-response/introduction.md). This is the response provided by the custom site API when it's called.
There are several functions you can use to create a response object. Find them in the Velo [`wix-http-functions` module](https://dev.wix.com/docs/velo/velo-only-apis/wix-http-functions/introduction.md).
## Authentication context
Authentication context is information about who is calling an API.
Calling Wix APIs with authentication context allows you to use functions that return different responses based on who calls them, such as [`getCurrentMember()`](https://dev.wix.com/docs/sdk/backend-modules/members/members/get-current-member.md).
Depending on whether you need to include [authentication context](#authentication-context) in your request, there are different ways to call your custom site API:
- [With authentication context](#with-authentication-context)
- [Without authentication context](#without-authentication-context)
### With authentication context
Call your API using the HTTP functions [REST API](https://dev.wix.com/docs/rest/assets/http-functions/rest/introduction.md) or [SDK module](https://dev.wix.com/docs/sdk/backend-modules/http-functions/functions/introduction.md). Provide these APIs with your HTTP function's details through the API's parameters and authorization.
You must publish your site for your custom site APIs to be available through these APIs.
### Without authentication context
Access your custom site APIs with different endpoints depending on the context in which you want to use them:
- Test sites
- Sites being built with [git integration](https://dev.wix.com/docs/develop-websites/articles/workspace-tools/developer-tools/git-integration-wix-cli/about-git-integration-wix-cli.md)
- Latest code in the editor
- Production
Learn more about [custom site API Calls](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/integrations/exposing-services/site-api-calls.md).
## HTTP Functions APIs
There are different Wix APIs for exposing and calling custom site APIs:
- [Velo HTTP Functions API](https://dev.wix.com/docs/velo/velo-only-apis/wix-http-functions/introduction.md): Use this API to write and expose your custom site APIs.
- [SDK](https://dev.wix.com/docs/sdk/backend-modules/http-functions/functions/introduction.md) and [REST](https://dev.wix.com/docs/rest/assets/http-functions/rest/introduction.md) HTTP Functions API: Use these APIs to call your custom site APIs with [authentication context](#authentication-context).
## See also
- [Write an HTTP function](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/integrations/exposing-services/write-an-http-function.md)
- [Methods for HTTP functions](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/integrations/exposing-services/methods-for-http-functions.md)
- [Custom site API calls](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/integrations/exposing-services/site-api-calls.md)