{"openapi":"3.1.0","info":{"version":"1.0.0","title":"IP Info API","description":"Call the IP Info API from your own code; every charged call uses your workspace's IP Info credits.\n\n**Authentication.** Create an API key in your workspace (Settings → API keys) and send it as the `x-api-key` header. A `read` key lists and reads; a `write` key also makes changes, like a workspace member; an `admin` key can do everything its owner can. Every call acts on the workspace of the key. Guide: https://api.ip-info.app/developers/auth.md\n\n**Errors.** Failures answer `{ \"error\": \"UPPER_SNAKE_CODE\", \"message\": \"...\" }` with the HTTP status; validation errors add `issues`. `402 INSUFFICIENT_CREDITS` means the credits are used up; `429` means slow down (see the `ratelimit-*` headers).\n\n**Ids** are UUIDv7 strings; times are ISO 8601 UTC.\n\n## AI Agents (MCP)\n\nThis API is also available as a hosted [MCP](https://modelcontextprotocol.io) server for AI agents at `https://mcp.ip-info.app/mcp` — Streamable HTTP (JSON-RPC 2.0), authenticated with the same `x-api-key` header and scoped to the key's workspace. API catalog: `https://api.ip-info.app/.well-known/api-catalog`."},"servers":[{"url":"https://api.ip-info.app","description":"IP Info"}],"components":{"schemas":{"BadRequestError":{"type":"object","properties":{"error":{"type":"string","example":"VALIDATION_ERROR","description":"Error code identifier"},"message":{"type":"string","example":"Invalid request parameters","description":"Human-readable error message"}},"required":["error","message"]},"UnauthorizedError":{"type":"object","properties":{"error":{"type":"string","example":"AUTHENTICATION_REQUIRED","description":"Error code"},"message":{"type":"string","example":"Authentication token is required","description":"Error message"}},"required":["error","message"]},"ForbiddenError":{"type":"object","properties":{"error":{"type":"string","example":"ACCESS_DENIED","description":"Error code"},"message":{"type":"string","example":"You do not have permission to perform this action","description":"Error message"}},"required":["error","message"]},"NotFoundError":{"type":"object","properties":{"error":{"type":"string","example":"NOT_FOUND","description":"Error code"},"message":{"type":"string","example":"The requested resource was not found","description":"Error message"}},"required":["error","message"]},"TooManyRequestsError":{"type":"object","properties":{"error":{"type":"string","example":"RATE_LIMIT_EXCEEDED","description":"Error code"},"message":{"type":"string","example":"Too many requests, please try again later","description":"Error message"}},"required":["error","message"]},"InternalServerError":{"type":"object","properties":{"error":{"type":"string","example":"INTERNAL_SERVER_ERROR","description":"Error code"},"message":{"type":"string","example":"An unexpected error occurred","description":"Error message"}},"required":["error","message"]},"ServiceUnavailableError":{"type":"object","properties":{"error":{"type":"string","example":"AUTHENTICATION_UNAVAILABLE","description":"Error code"},"message":{"type":"string","example":"Service temporarily unavailable","description":"Error message"}},"required":["error","message"]},"PaginationMeta":{"type":"object","properties":{"page":{"type":"integer","minimum":1},"limit":{"type":"integer","minimum":1,"maximum":200},"total":{"type":"integer","minimum":0},"totalPages":{"type":"integer","minimum":0},"hasNext":{"type":"boolean"},"hasPrev":{"type":"boolean"}},"required":["page","limit","total","totalPages","hasNext","hasPrev"]},"WalletBrandDomain":{"type":"string","enum":["any.xyz","phone-check.app","email-check.app","ip-info.app","ops.tools","currency-exchange.app"],"description":"Brand domain of the wallet (each product brand keeps its own credits, plans and Stripe customer)","example":"phone-check.app"},"CreditUsageDailyListResponse":{"type":"object","properties":{"daily":{"type":"array","items":{"$ref":"#/components/schemas/CreditUsageDailyModel"}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["daily","pagination"]},"CreditUsageDailyModel":{"type":"object","properties":{"_id":{"type":"string","format":"uuid","example":"018f6b1c-7e2a-7000-9d3e-4a5b6c7d8e9f","description":"UUID v7 identifier (36-character string)"},"workspaceId":{"type":"string","format":"uuid","example":"018f6b1c-7e2a-7000-9d3e-4a5b6c7d8e9f","description":"UUID v7 identifier (36-character string)"},"brandDomain":{"$ref":"#/components/schemas/WalletBrandDomain"},"userId":{"type":"string","format":"uuid","example":"018f6b1c-7e2a-7000-9d3e-4a5b6c7d8e9f","description":"UUID v7 identifier (36-character string)"},"service":{"type":"string","description":"Product service that consumed credits (e.g., \"phone-details\", \"email-check-details\")","example":"phone-details"},"date":{"type":"string","description":"Date in YYYY-MM-DD format","example":"2026-01-20"},"creditsUsed":{"type":"number","description":"Total credits consumed on this date","example":150},"requestCount":{"type":"number","description":"Number of requests made on this date","example":25},"metadata":{"type":"object","additionalProperties":{}}},"required":["_id","workspaceId","brandDomain","userId","service","date","creditsUsed","requestCount"]},"CreditUsageBreakdownResponse":{"type":"object","properties":{"workspaceId":{"type":"string","format":"uuid","example":"018f6b1c-7e2a-7000-9d3e-4a5b6c7d8e9f","description":"UUID v7 identifier (36-character string)"},"groupBy":{"type":"array","items":{"type":"string","enum":["date","user","api-key","service"]}},"totals":{"type":"object","properties":{"credits":{"type":"number","description":"Credits consumed in this slice."},"requests":{"type":"number","description":"Charged requests in this slice."}},"required":["credits","requests"]},"groups":{"type":"array","items":{"type":"object","properties":{"date":{"type":["string","null"],"description":"Usage day (YYYY-MM-DD, UTC).","example":"2026-07-01"},"userId":{"type":["string","null"],"format":"uuid","description":"Workspace member the usage attributes to (null when not grouped by user)."},"apiKeyId":{"type":["string","null"],"format":"uuid","description":"API key that made the calls (null for signed-in calls, or when not grouped by API key)."},"service":{"type":["string","null"],"description":"Product service that consumed credits.","example":"phone-details"},"credits":{"type":"number","description":"Credits consumed in this slice."},"requests":{"type":"number","description":"Charged requests in this slice."}},"required":["date","userId","apiKeyId","service","credits","requests"]}}},"required":["workspaceId","groupBy","totals","groups"]},"InsufficientCreditsError":{"type":"object","properties":{"error":{"type":"string","enum":["INSUFFICIENT_CREDITS"],"description":"Error code"},"message":{"type":"string","example":"No credits left: add credits or a plan under Billing","description":"Error message"}},"required":["error","message"]},"IpDetailsResponse":{"type":"object","properties":{"ip":{"type":"string","description":"The address looked up.","example":"8.8.8.8"},"city":{"type":"object","properties":{"name":{"type":"string","description":"City.","example":"Mountain View"},"region":{"type":"string","description":"Region, state or province.","example":"California"},"latitude":{"type":"number","example":37.751},"longitude":{"type":"number","example":-97.822},"accuracyRadius":{"type":"number","description":"Radius around the coordinates the address is within, km.","example":1000},"timeZone":{"type":"string","description":"IANA time zone.","example":"America/Chicago"}},"required":["accuracyRadius"],"description":"Location, when the address is in the city database."},"continentCode":{"type":"string","description":"Continent code (AF, AN, AS, EU, NA, OC, SA).","example":"NA"},"countryName":{"type":"string","description":"Country name, in English.","example":"United States"},"countryCode":{"type":"string","description":"ISO 3166-1 alpha-2 country where the address is used.","example":"US"},"registeredCountryCode":{"type":"string","description":"ISO 3166-1 alpha-2 country the address block is registered to; it can differ from `countryCode`.","example":"US"},"asn":{"type":"number","description":"Autonomous system number of the network.","example":15169},"asnOrganization":{"type":"string","description":"Organization that owns the autonomous system.","example":"Google LLC"}},"required":["ip"]}},"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"API Key authentication using the `x-api-key` header."}}},"paths":{"/credit-usage/daily/list":{"get":{"summary":"List the credits used per day","description":"List the credits the request brand's wallets used per day.","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"default":1,"example":1,"description":"Page number for pagination"},"required":false,"description":"Page number for pagination","name":"page","in":"query"},{"schema":{"type":"integer","exclusiveMinimum":0,"maximum":1000,"default":20,"example":200,"description":"Number of rows per page (max 1000, `CREDIT_USAGE_DAILY_LIST_MAX_LIMIT`): 90 days of usage in one request"},"required":false,"description":"Number of rows per page (max 1000, `CREDIT_USAGE_DAILY_LIST_MAX_LIMIT`): 90 days of usage in one request","name":"limit","in":"query"},{"schema":{"type":"string","description":"Filter by specific daily credit usage row IDs (comma-separated UUID v7)","example":"018f6b1c-7e2a-7000-9d3e-4a5b6c7d8e8f,018f6b1c-7e2a-7000-9d3e-4a5b6c7d8e8f"},"required":false,"description":"Filter by specific daily credit usage row IDs (comma-separated UUID v7)","name":"ids","in":"query"},{"schema":{"type":"string","format":"uuid","example":"018f6b1c-7e2a-7000-9d3e-000000000011","description":"Filter by specific workspace ID"},"required":false,"description":"Filter by specific workspace ID","name":"workspaceId","in":"query"},{"schema":{"type":"string","example":"phone-details","description":"Filter by service name (exact match)"},"required":false,"description":"Filter by service name (exact match)","name":"service","in":"query"},{"schema":{"type":"string","example":"2026-01-01","description":"Filter records from this date onwards (YYYY-MM-DD format)"},"required":false,"description":"Filter records from this date onwards (YYYY-MM-DD format)","name":"dateFrom","in":"query"},{"schema":{"type":"string","example":"2026-01-31","description":"Filter records up to this date (YYYY-MM-DD format)"},"required":false,"description":"Filter records up to this date (YYYY-MM-DD format)","name":"dateTo","in":"query"},{"schema":{"type":"string","enum":["date","creditsUsed","requestCount"],"default":"date","example":"date","description":"Field to sort by. Rows carry no timestamps, so the newest day first is the default."},"required":false,"description":"Field to sort by. Rows carry no timestamps, so the newest day first is the default.","name":"sortBy","in":"query"},{"schema":{"type":"string","enum":["asc","desc"],"default":"desc","example":"desc","description":"Sort order"},"required":false,"description":"Sort order","name":"sortOrder","in":"query"}],"responses":{"200":{"description":"Credit usage records retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditUsageDailyListResponse"}}}},"400":{"description":"Bad request - Invalid input parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestError"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"403":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenError"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TooManyRequestsError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}},"503":{"description":"The request could not be checked or served right now. It says nothing about the request; send it again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceUnavailableError"}}}}}}},"/credit-usage/breakdown":{"get":{"summary":"Get credit usage breakdown","description":"Credits the request brand's wallet used in a date range, grouped by date, member, API key or service.","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"018f6b1c-7e2a-7000-9d3e-000000000011","description":"Workspace to report usage for (required)."},"required":true,"description":"Workspace to report usage for (required).","name":"workspaceId","in":"query"},{"schema":{"type":"string","description":"From this day (inclusive, YYYY-MM-DD).","example":"2026-07-01"},"required":false,"description":"From this day (inclusive, YYYY-MM-DD).","name":"dateFrom","in":"query"},{"schema":{"type":"string","description":"To this day (inclusive, YYYY-MM-DD).","example":"2026-07-31"},"required":false,"description":"To this day (inclusive, YYYY-MM-DD).","name":"dateTo","in":"query"},{"schema":{"type":"string","default":["service"],"description":"Dimensions to group usage by (comma-separated subset of date / user / api-key / service).","example":"api-key,service"},"required":false,"description":"Dimensions to group usage by (comma-separated subset of date / user / api-key / service).","name":"groupBy","in":"query"}],"responses":{"200":{"description":"Credits used by the request brand wallet, grouped by the requested dimension(s), highest-credit first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditUsageBreakdownResponse"}}}},"400":{"description":"Bad request - Invalid input parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestError"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"403":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenError"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TooManyRequestsError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}},"503":{"description":"The request could not be checked or served right now. It says nothing about the request; send it again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceUnavailableError"}}}}}}},"/ip/details":{"get":{"summary":"Locate an IP address","description":"Locate `ip` (the caller's address when omitted): city, region, coordinates, time zone, continent, country, registered country and its network (ASN and owner); costs 1 credit, and a request with no `ip` and no caller address answers 400 `IP_REQUIRED` for free.","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"anyOf":[{"type":"string","format":"ip"},{"type":"string","format":"ip"}],"description":"IPv4 or IPv6 address; the caller's own address when omitted.","example":"8.8.8.8"},"required":false,"description":"IPv4 or IPv6 address; the caller's own address when omitted.","name":"ip","in":"query"},{"schema":{"type":"boolean","default":false,"description":"Read fresh instead of the cached answer."},"required":false,"description":"Read fresh instead of the cached answer.","name":"skipCache","in":"query"}],"responses":{"200":{"description":"The address located","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IpDetailsResponse"}}}},"400":{"description":"Bad request - Invalid input parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestError"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"402":{"description":"The API key's workspace has no credits left on this brand","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsufficientCreditsError"}}}},"403":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenError"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TooManyRequestsError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}},"503":{"description":"The request could not be checked or served right now. It says nothing about the request; send it again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceUnavailableError"}}}}}}}},"webhooks":{}}