Docs / Location

One field of an IP

Returns one field of an address as plain text. The address is looked up in DB-IP Country Lite.

GET/v1/ip/{ip}/{field}
import { Client } from "@liveapiio/liveapi";

const client = new Client({ token: process.env.LIVEAPI_TOKEN });

const country = await client.lookupField("8.8.8.8", "country");

Request

Send Authorization: Bearer YOUR_TOKEN. The token stays on your server. Each library reads it from the environment and calls this endpoint for you.

FieldTypeDescription
ipstringIPv4 or IPv6 address. Path parameter.
fieldstringOne of the field names accepted by the calling-IP field call.

Response

A 200 response uses one call. The body is the field value as text. The full JSON attribution is not included on this call.

Errors

A failed request returns { "error": { "code", "message" } } and does not use a call.

StatusCodeWhen
404not_foundUnknown address, unknown field, or the field is empty.
503upstream_unavailableThe location database is not loaded.
401unauthorizedThe bearer token is missing or not recognized.

We value your privacy

We use necessary cookies to run this website. With your consent, we would also like to use analytics and marketing cookies. Read our cookie policy.