200 OK
API v1

A test API for development and debugging.

Endpoints

IP

/v1/ip

Output
GET

The client’s IPv4 and IPv6 addresses.

Details
Request examples

GET

curl 'http://localhost:3000/v1/ip'
Responses
200 OK

The client connection address. This example uses a documentation IP. An unknown address family is unknown in text and null in JSON.

Example · text/plain

v4: 192.0.2.1
v6: unknown
400 Bad Request

Invalid format, such as ?format=xml. This error is always returned as plain text.

Example · text/plain

Unsupported format: xml
Valid values: text, json

/v1/ip/v4

Output
GET

The client’s IPv4 address.

Details
Request examples

GET

curl 'http://localhost:3000/v1/ip/v4'
Responses
200 OK

The client connection address. This example uses a documentation IP. An unknown address family is unknown in text and null in JSON.

Example · text/plain

192.0.2.1
400 Bad Request

Invalid format, such as ?format=xml. This error is always returned as plain text.

Example · text/plain

Unsupported format: xml
Valid values: text, json

/v1/ip/v6

Output
GET

The client’s IPv6 address.

Details
Request examples

GET

curl 'http://localhost:3000/v1/ip/v6'
Responses
200 OK

The client connection address. This example uses a documentation IP. An unknown address family is unknown in text and null in JSON.

Example · text/plain

2001:db8::1
400 Bad Request

Invalid format, such as ?format=xml. This error is always returned as plain text.

Example · text/plain

Unsupported format: xml
Valid values: text, json

Echo

/v1/echo

Output
GETPOSTPUTPATCHDELETE

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

Details
Request examples

POST · JSON

curl 'http://localhost:3000/v1/echo' \
  -H 'Content-Type: application/json' \
  --data-binary '{"name":"Bob"}'

POST · Plain text

curl 'http://localhost:3000/v1/echo' \
  -H 'Content-Type: text/plain' \
  --data-binary 'Hello!'

POST · Form

curl 'http://localhost:3000/v1/echo' \
  --data-urlencode 'name=Bob' \
  --data-urlencode 'age=42'

POST · Binary file

curl 'http://localhost:3000/v1/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
400 Bad Request

Invalid format, such as ?format=xml. This error is always returned as plain text.

Example · text/plain

Unsupported format: xml
Valid values: text, json
413 Payload Too Large

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

Example · text/plain

Request body exceeds the size limit of 100 KiB
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

Invalid JSON also returns 400. Parser syntax and encoding errors currently use Express’s default HTML response regardless of the selected output format.

Headers

/v1/headers

Output
GET

Incoming request headers.

Details
Request examples

With a custom header

curl 'http://localhost:3000/v1/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:  */*
400 Bad Request

Invalid format, such as ?format=xml. This error is always returned as plain text.

Example · text/plain

Unsupported format: xml
Valid values: text, json