> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Web requests overview

> Choose between xCurl, libHttpClient, and WinHTTP for HTTP and WebSocket calls in GDK titles, and handle suspend and resume correctly on console.

This article provides an overview of Hypertext Transfer Protocol (HTTP) and WebSocket web requests for Microsoft Game Development Kit (GDK) titles.

Starting with the right API set makes it easier for you to implement secure and robust web requests.

## Common APIs for GDK titles

The following APIs are commonly used for secure and robust web requests in Microsoft Game Development Kit (GDK) titles. They also help simplify implementation.

| Use case | Common API choice |
| - | - |
| REST requests with Gaming Runtime Services (GRTS) style APIs | [Microsoft XBOX Live Service API (XSAPI)](#xsapi) |
| General purpose HTTP requests | [xCurl](#xcurl) |
| WebSocket requests | [libHttpClient](#libhttpclient) |

**Windows HTTP Services (WinHTTP)**

WinHTTP can also be used to create HTTP and WebSocket service endpoints on both PCs and XBOX consoles with no code changes. Because this API doesn't automatically handle all security best practices, make sure to read [Communication Security Overview (NDA article)](/build/game-principles/security/communication-security-overview) and [WinHTTP overview](/build/console-features/networking/web-requests/intro-winhttp) to learn how to ensure that your implementation is secure and robust.

`xCurl` handles security best practices, including certificate chain validation and networking connectivity checks. It also manages network initialization and suspend/resume automatically.

If your title uses WinHTTP or another HTTP stack instead of xCurl, assume that the title owns platform integration work such as network initialization, suspend/resume handling, and explicit security configuration. For sequencing and lifecycle guidance, see [Network initialization and connectivity](/build/console-features/networking/initialization-connectivity-networking) and [WinHTTP overview](/build/console-features/networking/web-requests/intro-winhttp).

For proxy-based debugging workflows on XBOX, start with [Fiddler on XBOX consoles](/build/console-features/networking/tools/fiddler-setup-networking). If your title uses a custom stack, see [Debugging custom HTTP stacks](/build/console-features/networking/web-requests/debugging-custom-http-stacks) for XBOX-specific proxy and certificate guidance.

## xCurl

**xCurl** is an HTTP API available to Microsoft Game Development Kit (GDK) titles. It simplifies title development by adhering to all security best practices automatically. Since the API surface broadly matches [libCurl](https://curl.haxx.se/libcurl/), it also has libCurl's full flexibility and HTTP feature set.

To learn more about the **xCurl** API and differences between **xCurl** and **libCurl**, see [xCurl overview](/build/console-features/networking/web-requests/intro-xcurl).

## XSAPI

[XBOX Services API (XSAPI)](https://developer.microsoft.com/games/xbox/docs/gdk/atoc-xsapi-c) provides a generic REST wrapper for Microsoft Game Development Kit (GDK) titles. This wrapper is straightforward to use and follows the Microsoft Game Development Kit (GDK) asynchronous API model. If your title only needs to make REST HTTP requests, this is likely the simplest interface to use.

1. Use [XblHttpCallCreate](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallcreate) to create an HTTP handle to track your `REST` request.
2. Fill in the body and any extra configuration with one of the `XblHttpCallRequestSet*` functions.
3. Call [XblHttpCallPerformAsync](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallperformasync) to make the request.
4. To retrieve the response, use one of the `XblHttpCallGet*` functions.
5. Close the handle by using [XblHttpCallCloseHandle](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallclosehandle).

> [!NOTE]
>
> `XblHttpCallRequestSet*` and `XblHttpCallGet*` represent groups of functions to build HTTP requests and retrieve HTTP responses.
>
> * [XblHttpCallRequestSetHeader](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallrequestsetheader)
>
> * [XblHttpCallRequestSetLongHttpCall](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallrequestsetlonghttpcall)
>
> * [XblHttpCallRequestSetRequestBodyBytes](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallrequestsetrequestbodybytes)
>
> * [XblHttpCallRequestSetRequestBodyString](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallrequestsetrequestbodystring)
>
> * [XblHttpCallRequestSetRetryAllowed](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallrequestsetretryallowed)
>
> * [XblHttpCallRequestSetRetryCacheId](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallrequestsetretrycacheid)
>
> * [XblHttpCallGetHeader](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetheader)
>
> * [XblHttpCallGetHeaderAtIndex](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetheaderatindex)
>
> * [XblHttpCallGetNetworkErrorCode](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetnetworkerrorcode)
>
> * [XblHttpCallGetNumHeaders](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetnumheaders)
>
> * [XblHttpCallGetPlatformNetworkErrorMessage](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetplatformnetworkerrormessage)
>
> * [XblHttpCallGetRequestUrl](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetrequesturl)
>
> * [XblHttpCallGetResponseBodyBytes](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetresponsebodybytes)
>
> * [XblHttpCallGetResponseBodyBytesSize](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetresponsebodybytessize)
>
> * [XblHttpCallGetResponseString](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetresponsestring)
>
> * [XblHttpCallGetStatusCode](/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetstatuscode)

## libHttpClient

The [libHttpClient](https://github.com/Microsoft/libHttpClient) is designed to enable two-way communication. It's an abstraction layer designed for use by XBOX Live Service API (XSAPI) to enable HTTP and WebSocket service endpoints. The API is in the Game Development Kit (GDK) as part of XSAPI.

### Suspend and resume with libHttpClient

Unlike xCurl, `libHttpClient` doesn't automatically drain or tear down in-flight work when the title suspends. Titles that use `libHttpClient` (including its WebSocket support) must handle the suspend/resume lifecycle explicitly. Retail consoles enter suspend on standby, so a WebSocket connection or async operation left open across suspend can hang or crash on resume even when the same title suspends and resumes cleanly on a dev kit.

On suspend or shutdown:

* Stop queueing new HTTP and WebSocket work.
* Cancel or drain in-flight requests and WebSocket sends and receives.
* Close WebSocket connections and destroy HTTP call handles, sessions, and sockets that shouldn't survive suspend.

On resume, wait for `XNetworkingConnectivityHint::networkInitialized` to be `true` before recreating `libHttpClient` state or reopening WebSocket connections.

For the full sequencing rules and the reasoning behind them, see [Detecting network initialization status](/build/console-features/networking/initialization-connectivity-networking) and the game life-cycle guidance in [Responding to suspend and resume](/build/console-features/console-workflows/xbox-game-life-cycle#responding-to-suspend-and-resume).

## See also

[Windows HTTP Services (WinHTTP)](https://learn.microsoft.com/windows/desktop/winhttp/winhttp-start-page)

[libCurl](https://curl.haxx.se/libcurl/)

[Setting up web services at Partner Center (NDA article)](/services/xbox-services/fundamentals/s2s-auth-calls/custom-service-config/web-services/live-web-services)

[Fiddler on XBOX consoles](/build/console-features/networking/tools/fiddler-setup-networking)

[Communication Security Overview (NDA article)](/build/game-principles/security/communication-security-overview)


## Related topics

- [Web requests (contents)](/build/console-features/networking/web-requests/web-requests-toc.md)
- [Web requests and HTTP stacks on XBOX](/build/console-features/networking/web-requests/index.md)
- [Web request differences between GDK and XDK](/build/console-features/networking/xdk-migration/xdk-migration-web-requests-networking.md)
- [Web Content Test Application (CTA) overview](/build/core-features/common/game-streaming/game-streaming-web-content-test-application.md)
- [WinHTTP overview](/build/console-features/networking/web-requests/intro-winhttp.md)
