---
title: "api request for the socket · RUAL Documentation"
description: "Sends a request to this core's own API on behalf of the socket of the run, in process: the route sees the socket's address, user agent and host."
canonical: https://docs.rual.nl/block-types/realtime/socket_api_request
language: en
---

# api request for the socket

This block is part of the [`realtime`](https://docs.rual.nl/block-types/realtime) group and was last modified in core [`v15.0.3`](https://docs.rual.nl/core-versions/150003).

Sends a request to this core's own API on behalf of the socket of the run, in process: the route sees the socket's address, user agent and host.

- flow

- method `value` GET, POST, PUT, PATCH or DELETE. Defaults to POST.

- path `value` required A path under `/api/`, without the entity, e.g. `/api/v1/auth/login`.

- body `object` Sent as JSON. Not sent with GET.

- query `object`

- token `value` An access token to send the request with. Without it the request is anonymous.

- flow

- success `condition` The route answered with a 2xx status.

- status `number`

- body `object` The route's answer: decoded JSON, or text.

- error `value`

For a socket method that must reach one of the core's own HTTP routes for its client: a sign-in (/api/v1/auth/login), a renewal, a verification code. The request runs through the whole router in process, as the same request over HTTP from the socket's client would: the socket's address is the client address every ban and rate budget counts, and the request carries only the token given in the token pin (none: an anonymous request). The socket is always the run's own; on a run without one the block reports NO_SOCKET. path starts with /api/ and names no entity (the socket's entity is used). success is true for a 2xx status; a route's refusal is not an error: read status and body. error is set only when no request was made or no answer could be read (NO_SOCKET, API_NOT_AVAILABLE, BAD_PATH, BAD_METHOD, BAD_BODY, BAD_QUERY for a query that carries access_token, RESPONSE_TOO_LARGE, CANCELLED). Skipped in a simulation.

## Version history

Introduced in [`v15.0.3`](https://docs.rual.nl/core-versions/150003).

- [Back to `realtime`](https://docs.rual.nl/block-types/realtime): Return to the main group to view all sub-groups

- [Back to `socket`](https://docs.rual.nl/block-types/realtime?group=socket): Return to the group to view all blocks within this group
