# HTTP Request & Response Service

Inspect requests, test responses, and debug integrations.

For random strings and IDs, try [rand.hacks.run](https://rand.hacks.run/).

**Base URL**

https://200ok.hacks.run

**Output**

Plain text is returned by default. Use `?json` for compact JSON or `?pretty` for formatted JSON. Flags are enabled by their presence, regardless of value. `?pretty` takes priority over `?json`.

**Run locally**

```sh
docker run --rm -p 3000:3000 ghcr.io/teplostanski/200ok:latest
```

[http://localhost:3000](http://localhost:3000/)

JSON nesting defaults to 64 object or array levels. For deeper local tests, set JSON\_MAX\_DEPTH between 1 and 512. The 100 KiB body limit still applies.

```sh
docker run --rm -e JSON_MAX_DEPTH=256 -p 3000:3000 ghcr.io/teplostanski/200ok:latest
```

## Status

### `/status/{code}`

[HTTP status code reference](https://200ok.hacks.run/status-codes)

GET, POST, PUT, PATCH, DELETE

Returns the selected HTTP status code and its reason phrase.

**Important:** Codes `204`, `205` and `304` have no response body. For `1xx`, the HTTP response status is `200`.

**Details**

#### Request examples

GET

```sh
curl https://200ok.hacks.run/status/200
```

#### Responses

##### 200 OK

The response body contains the requested code and its reason phrase, including for 1xx. Example: 200 OK.

Example · text/plain

```
200 OK
```

Example · application/json

```
{"code":200,"reason":"OK"}
```

Schema · object

| Field | Type | Description |
| --- | --- | --- |
| `code`required | `integer` | Header value. |
| `reason`required | `string` | Header value. |

Example · application/json

```
{
  "code": 200,
  "reason": "OK"
}
```

Schema · object

| Field | Type | Description |
| --- | --- | --- |
| `code`required | `integer` | Header value. |
| `reason`required | `string` | Header value. |

## IP

### [`/ip`](https://200ok.hacks.run/ip)

GET

The client’s IP address (IPv4 or IPv6).

**Details**

#### Request examples

GET

```sh
curl https://200ok.hacks.run/ip
```

#### Responses

##### 200 OK

The client’s IP address (IPv4 or IPv6).

Example · text/plain

```
192.0.2.1
```

Example · application/json

```
{"ip":"192.0.2.1"}
```

Schema · object

| Field | Type | Description |
| --- | --- | --- |
| `ip`required | `string` | The client’s IP address (IPv4 or IPv6). |

Example · application/json

```
{
  "ip": "192.0.2.1"
}
```

Schema · object

| Field | Type | Description |
| --- | --- | --- |
| `ip`required | `string` | The client’s IP address (IPv4 or IPv6). |

### [`/ip/v4`](https://200ok.hacks.run/ip/v4)

GET

The client’s IPv4 address.

**Details**

#### Request examples

GET

```sh
curl https://200ok.hacks.run/ip/v4
```

#### Responses

##### 200 OK

The client connection address. This example uses a documentation IP. If the address family does not match the endpoint, the response is unknown in text and null in JSON.

Example · text/plain

```
192.0.2.1
```

Example · application/json

```
{"ip":"192.0.2.1"}
```

Schema · object

| Field | Type | Description |
| --- | --- | --- |
| `ip`required | `string | null` | IP address; null if the address family does not match. |

Example · application/json

```
{
  "ip": "192.0.2.1"
}
```

Schema · object

| Field | Type | Description |
| --- | --- | --- |
| `ip`required | `string | null` | IP address; null if the address family does not match. |

### [`/ip/v6`](https://200ok.hacks.run/ip/v6)

GET

The client’s IPv6 address.

**Details**

#### Request examples

GET

```sh
curl https://200ok.hacks.run/ip/v6
```

#### Responses

##### 200 OK

The client connection address. This example uses a documentation IP. If the address family does not match the endpoint, the response is unknown in text and null in JSON.

Example · text/plain

```
2001:db8::1
```

Example · application/json

```
{"ip":"2001:db8::1"}
```

Schema · object

| Field | Type | Description |
| --- | --- | --- |
| `ip`required | `string | null` | IP address; null if the address family does not match. |

Example · application/json

```
{
  "ip": "2001:db8::1"
}
```

Schema · object

| Field | Type | Description |
| --- | --- | --- |
| `ip`required | `string | null` | IP address; null if the address family does not match. |

## Echo

### [`/echo`](https://200ok.hacks.run/echo)

GET, POST, PUT, PATCH, DELETE

Returns the request method and body. Accepts JSON, plain text, URL-encoded forms, and binary data.

**Details**

#### Request examples

POST · JSON

```sh
curl https://200ok.hacks.run/echo \
  -H 'Content-Type: application/json' \
  --data-binary '{"name":"Bob"}'
```

POST · Plain text

```sh
curl https://200ok.hacks.run/echo \
  -H 'Content-Type: text/plain' \
  --data-binary 'Hello!'
```

POST · Form

```sh
curl https://200ok.hacks.run/echo \
  --data-urlencode 'name=Bob' \
  --data-urlencode 'age=42'
```

POST · Binary file

```sh
curl https://200ok.hacks.run/echo \
  -H 'Content-Type: application/octet-stream' \
  --data-binary '@./file.bin'
```

#### Responses

##### 200 OK

The method and parsed request body. This example is a GET request without a body.

Example · text/plain

```
GET

null
```

Example · application/json

```
{"method":"GET","body":null}
```

Schema · object

| Field | Type | Description |
| --- | --- | --- |
| `method`required | `string` | The HTTP request method. |
| `body`required | `object | array | string | number | boolean | null` | A JSON value, string, form fields, or binary body { encoding: 'base64', sizeBytes: number, data: string }. Null when no body is provided. |

**body · binary object**

| Field | Type | Description |
| --- | --- | --- |
| `encoding`required | `string` | Always `"base64"`. |
| `sizeBytes`required | `integer` | Number of original bytes. |
| `data`required | `string` | Base64-encoded content. |

Example · application/json

```
{
  "method": "GET",
  "body": null
}
```

Schema · object

| Field | Type | Description |
| --- | --- | --- |
| `method`required | `string` | The HTTP request method. |
| `body`required | `object | array | string | number | boolean | null` | A JSON value, string, form fields, or binary body { encoding: 'base64', sizeBytes: number, data: string }. Null when no body is provided. |

**body · binary object**

| Field | Type | Description |
| --- | --- | --- |
| `encoding`required | `string` | Always `"base64"`. |
| `sizeBytes`required | `integer` | Number of original bytes. |
| `data`required | `string` | Base64-encoded content. |

##### 413 Payload Too Large

The body exceeds 102,400 bytes (100 KiB).

Example · text/plain

```
Request body exceeds the size limit of 100 KiB
```

Example · application/json

```
{"error":"Request body exceeds the size limit of 100 KiB","limitBytes":102400}
```

Schema · object

| Field | Type | Description |
| --- | --- | --- |
| `error`required | `string` | Error description. |
| `limitBytes`required | `integer` | Maximum body size in bytes. Value: `102400`. |

Example · application/json

```
{
  "error": "Request body exceeds the size limit of 100 KiB",
  "limitBytes": 102400
}
```

Schema · object

| Field | Type | Description |
| --- | --- | --- |
| `error`required | `string` | Error description. |
| `limitBytes`required | `integer` | Maximum body size in bytes. Value: `102400`. |

##### 415 Unsupported Media Type

An unsupported or missing Content-Type for a nonempty body.

Example · text/plain

```
Unsupported Content-Type. Supported: application/json, text/plain, application/x-www-form-urlencoded, application/octet-stream
```

Example · application/json

```
{"error":"Unsupported Content-Type. Supported: application/json, text/plain, application/x-www-form-urlencoded, application/octet-stream"}
```

Schema · object

| Field | Type | Description |
| --- | --- | --- |
| `error`required | `string` | Error description. |

Example · application/json

```
{
  "error": "Unsupported Content-Type. Supported: application/json, text/plain, application/x-www-form-urlencoded, application/octet-stream"
}
```

Schema · object

| Field | Type | Description |
| --- | --- | --- |
| `error`required | `string` | Error description. |

Invalid JSON returns 400. API errors use the selected output format: plain text or JSON.

## Headers

### [`/headers`](https://200ok.hacks.run/headers)

GET

Incoming request headers.

**Details**

#### Request examples

With a custom header

```sh
curl https://200ok.hacks.run/headers \
  -H 'X-Test: hello'
```

#### Responses

##### 200 OK

Incoming request headers. Names and values depend on the client.

Example · text/plain

```
host:  localhost:3000

accept:  */*
```

Example · application/json

```
{"host":"localhost:3000","accept":"*/*"}
```

Schema · object

| Field | Type | Description |
| --- | --- | --- |
| `[header name]` | `string | string[]` | Header value. |

Example · application/json

```
{
  "host": "localhost:3000",
  "accept": "*/*"
}
```

Schema · object

| Field | Type | Description |
| --- | --- | --- |
| `[header name]` | `string | string[]` | Header value. |
