{"openapi":"3.0.3","info":{"title":"LookupNest API","version":"1.0.0","description":"Account, API key management, IP lookup, health, and readiness endpoints for the LookupNest API."},"servers":[{"url":"/api/v1","description":"API"}],"paths":{"/webhooks/dodo":{"post":{"summary":"Signed Dodo payment and subscription events (raw JSON)","parameters":[{"in":"header","name":"webhook-id","required":true,"schema":{"type":"string"}},{"in":"header","name":"webhook-signature","required":true,"schema":{"type":"string"}},{"in":"header","name":"webhook-timestamp","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","data","timestamp"]}}}},"responses":{"200":{"description":"Processed or safely ignored; payment ID prevents duplicate credit grants"},"401":{"description":"Missing or invalid signature"},"409":{"description":"Checkout or subscription validation mismatch"},"502":{"description":"Provider verification unavailable; retry delivery"}}}},"/auth/forgot-password":{"post":{"summary":"Email a single-use password reset link (30 minutes)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["email"],"properties":{"email":{"type":"string","format":"email"}}}}}},"responses":{"200":{"description":"Success; forgot-password uses a generic response"},"400":{"description":"Invalid input, incorrect current password, or expired reset token"},"401":{"description":"Invalid or revoked session"},"429":{"description":"Too many attempts"}}}},"/auth/reset-password":{"post":{"summary":"Reset password and revoke login sessions","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["token","password"],"properties":{"password":{"type":"string","minLength":12,"maxLength":72},"token":{"type":"string","pattern":"^[a-f0-9]{64}$"}}}}}},"responses":{"200":{"description":"Success; forgot-password uses a generic response"},"400":{"description":"Invalid input, incorrect current password, or expired reset token"},"401":{"description":"Invalid or revoked session"},"429":{"description":"Too many attempts"}}}},"/auth/change-password":{"post":{"summary":"Change password and revoke login sessions","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["currentPassword","password"],"properties":{"password":{"type":"string","minLength":12,"maxLength":72},"currentPassword":{"type":"string"}}}}}},"responses":{"200":{"description":"Success; forgot-password uses a generic response"},"400":{"description":"Invalid input, incorrect current password, or expired reset token"},"401":{"description":"Invalid or revoked session"},"429":{"description":"Too many attempts"}}}},"/admin/overview":{"get":{"summary":"Administrator: overview","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Administrative data; current database admin role required"},"401":{"description":"Account authentication required"},"403":{"description":"Administrator role required"}}}},"/admin/users":{"get":{"summary":"Administrator: users","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Administrative data; current database admin role required"},"401":{"description":"Account authentication required"},"403":{"description":"Administrator role required"}}}},"/admin/plans":{"get":{"summary":"Administrator: plans","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Administrative data; current database admin role required"},"401":{"description":"Account authentication required"},"403":{"description":"Administrator role required"}}}},"/admin/logs":{"get":{"summary":"Administrator: logs","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Administrative data; current database admin role required"},"401":{"description":"Account authentication required"},"403":{"description":"Administrator role required"}}}},"/admin/transactions":{"get":{"summary":"Administrator: transactions","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Administrative data; current database admin role required"},"401":{"description":"Account authentication required"},"403":{"description":"Administrator role required"}}}},"/lookup/email":{"post":{"summary":"Verify an email through Redis, shared database, or FraudDefense","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"}}}}}},"responses":{"200":{"description":"Email verification data, source and credit metadata; lookup_left is omitted"},"400":{"description":"Invalid email"},"401":{"description":"Authentication required"},"402":{"description":"Insufficient credits"},"502":{"description":"Invalid or unsuccessful provider response"},"503":{"description":"Provider unavailable or not configured"}}}},"/transactions":{"get":{"summary":"List your payment and plan transactions","security":[{"bearerAuth":[]}],"parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}}],"responses":{"200":{"description":"Account-scoped transactions, 25 per page"},"401":{"description":"Account authentication required"}}}},"/usage/export":{"get":{"summary":"Download all matching lookup activity as CSV","security":[{"bearerAuth":[]}],"parameters":[{"name":"type","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"source","in":"query","schema":{"type":"string"}},{"name":"search","in":"query","schema":{"type":"string"}},{"name":"from","in":"query","schema":{"type":"string"}},{"name":"to","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"CSV attachment streamed in batches; same filters as reports","content":{"text/csv":{"schema":{"type":"string"}}}},"400":{"description":"Invalid filters"},"401":{"description":"Account authentication required"}}}},"/plans/catalog":{"get":{"summary":"List active plans","security":[],"responses":{"200":{"description":"Active plans ordered by price"}}}},"/plans":{"get":{"summary":"List available plans, current selection and credit balance","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Plan catalog with creditsClaimed flags, activePlanId and balance"},"401":{"description":"Account authentication required"}}}},"/plans/{id}/activate":{"post":{"summary":"Activate a plan instantly without payment; credits granted once per plan","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":false}}}},"responses":{"200":{"description":"activePlanId, balance and creditsAdded; repeated activation grants zero"},"400":{"description":"Invalid plan ID or request body"},"401":{"description":"Account authentication required"},"404":{"description":"Plan unavailable"}}}},"/usage/logs":{"get":{"summary":"List your lookup logs (25 per page)","security":[{"bearerAuth":[]}],"parameters":[{"name":"type","in":"query","schema":{"type":"string"},"description":"Optional usage filter"},{"name":"status","in":"query","schema":{"type":"string"},"description":"Optional usage filter"},{"name":"source","in":"query","schema":{"type":"string"},"description":"Optional usage filter"},{"name":"from","in":"query","schema":{"type":"string"},"description":"ISO UTC date-time"},{"name":"to","in":"query","schema":{"type":"string"},"description":"ISO UTC date-time"},{"name":"page","in":"query","schema":{"type":"string"},"description":"Optional usage filter"}],"responses":{"200":{"description":"Account-scoped usage data; reports are aggregated from logs."},"400":{"description":"Invalid filters"},"401":{"description":"Account authentication required"}}}},"/usage/report":{"get":{"summary":"Get your credit balance and usage report","security":[{"bearerAuth":[]}],"parameters":[{"name":"type","in":"query","schema":{"type":"string"},"description":"Optional usage filter"},{"name":"status","in":"query","schema":{"type":"string"},"description":"Optional usage filter"},{"name":"source","in":"query","schema":{"type":"string"},"description":"Optional usage filter"},{"name":"from","in":"query","schema":{"type":"string"},"description":"ISO UTC date-time"},{"name":"to","in":"query","schema":{"type":"string"},"description":"ISO UTC date-time"},{"name":"page","in":"query","schema":{"type":"string"},"description":"Optional usage filter"}],"responses":{"200":{"description":"Account-scoped usage data; reports are aggregated from logs."},"400":{"description":"Invalid filters"},"401":{"description":"Account authentication required"}}}},"/usage/logs/{id}":{"get":{"summary":"Read your log with the referenced shared IP details","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Log and current shared IP data"},"404":{"description":"Log does not belong to this account or does not exist"}}}},"/auth/register":{"post":{"summary":"Register a user account","operationId":"register","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterRequest"}}}},"responses":{"201":{"description":"Verification code sent by email; no access token is issued yet.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegistrationResponse"}}}},"400":{"description":"Invalid request."},"409":{"description":"An account already exists for this email."},"429":{"description":"Too many authentication attempts."}}}},"/auth/login":{"post":{"summary":"Sign in with email and password","operationId":"login","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}}},"responses":{"200":{"description":"Signed in.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"400":{"description":"Invalid request."},"401":{"description":"Invalid email or password."},"429":{"description":"Too many authentication attempts."}}}},"/auth/verify-email":{"post":{"summary":"Verify an email address using the emailed one-time code","operationId":"verifyEmail","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyEmailRequest"}}}},"responses":{"200":{"description":"Email verified."},"400":{"description":"Verification code is invalid or expired."},"429":{"description":"Too many verification attempts."}}}},"/auth/verification/resend":{"post":{"summary":"Resend email verification","operationId":"resendVerification","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResendVerificationRequest"}}}},"responses":{"200":{"description":"Generic response to prevent email enumeration."},"429":{"description":"Too many verification attempts."}}}},"/auth/google":{"post":{"summary":"Sign in with a Google ID token","operationId":"loginWithGoogle","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoogleTokenRequest"}}}},"responses":{"200":{"description":"Signed in.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"401":{"description":"Google token could not be verified."},"409":{"description":"An existing account must be authenticated before linking Google."},"429":{"description":"Too many authentication attempts."}}}},"/auth/google/link":{"post":{"summary":"Link Google to the authenticated account","operationId":"linkGoogleAccount","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoogleTokenRequest"}}}},"responses":{"200":{"description":"Google account linked."},"401":{"description":"Authentication or Google token is invalid."},"403":{"description":"Verified Google email does not match the authenticated user."},"409":{"description":"Google account is linked to another account or cannot be linked."}}}},"/auth/me":{"get":{"summary":"Get the authenticated user","operationId":"getCurrentUser","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Authenticated user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserResponse"}}}},"401":{"description":"Authentication is required or the token is invalid."}}}},"/api-keys":{"get":{"summary":"List API keys for the authenticated account","operationId":"listApiKeys","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"API key metadata, configured domain allowlists, and latest caller IP/origin. Secret values are never returned by this endpoint."},"401":{"description":"Authentication is required or the token is invalid."}}},"post":{"summary":"Create an API key","operationId":"createApiKey","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiKeyRequest"}}}},"responses":{"201":{"description":"API key created; the full secret is returned once."},"400":{"description":"Invalid key name."},"401":{"description":"Authentication is required or the token is invalid."}}}},"/api-keys/{id}/rotate":{"post":{"summary":"Rotate an API key owned by the authenticated account","operationId":"rotateApiKey","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"API key rotated; the new full secret is returned once."},"401":{"description":"Authentication is required or the token is invalid."},"404":{"description":"API key was not found for this account."}}}},"/api-keys/{id}/status":{"patch":{"summary":"Activate or deactivate an API key owned by the authenticated account","operationId":"setApiKeyStatus","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetApiKeyStatusRequest"}}}},"responses":{"200":{"description":"API key status updated."},"400":{"description":"Invalid API key status."},"401":{"description":"Authentication is required or the token is invalid."},"404":{"description":"API key was not found for this account."}}}},"/api-keys/{id}/domains":{"put":{"summary":"Replace the allowed browser-origin domains for an API key","operationId":"setApiKeyDomains","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetApiKeyDomainsRequest"}}}},"responses":{"200":{"description":"Allowed domains updated."},"400":{"description":"Invalid domain list."},"401":{"description":"Authentication is required or the token is invalid."},"404":{"description":"API key was not found for this account."}}}},"/api-keys/{id}/ips":{"put":{"summary":"Replace the allowed caller IP addresses for an API key","operationId":"setApiKeyIps","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetApiKeyIpsRequest"}}}},"responses":{"200":{"description":"Allowed IP addresses updated."},"400":{"description":"Invalid IP address list."},"401":{"description":"Authentication is required or the token is invalid."},"404":{"description":"API key was not found for this account."}}}},"/lookup/ip":{"post":{"summary":"Check an IP address for fraud risk","operationId":"lookupIp","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IpLookupRequest"}}}},"responses":{"200":{"description":"IP reputation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IpLookupResponse"}}}},"400":{"description":"Invalid IP address."},"401":{"description":"Authentication is required or the token is invalid."},"403":{"description":"The browser Origin is missing or is not allowed for this API key."},"429":{"description":"The authenticated user exceeded the IP lookup rate limit."},"502":{"description":"The lookup provider returned an invalid or unsuccessful response."},"503":{"description":"The lookup provider is not configured or is rate limited."},"504":{"description":"The lookup provider timed out."}}}},"/health":{"get":{"summary":"Check API process health","operationId":"getHealth","responses":{"200":{"description":"The API process is responsive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/health/ready":{"get":{"summary":"Check dependency readiness","operationId":"getReadiness","responses":{"200":{"description":"The required dependencies are available.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadinessResponse"}}}},"503":{"description":"One or more required dependencies are unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadinessResponse"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"apiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"CreateApiKeyRequest":{"type":"object","additionalProperties":false,"required":["name"],"properties":{"name":{"type":"string","minLength":2,"maxLength":80}}},"SetApiKeyStatusRequest":{"type":"object","additionalProperties":false,"required":["active"],"properties":{"active":{"type":"boolean"}}},"SetApiKeyDomainsRequest":{"type":"object","additionalProperties":false,"required":["domains"],"properties":{"domains":{"type":"array","maxItems":50,"items":{"type":"string","maxLength":300,"description":"Hostname only, optionally prefixed by http:// or https://; no port or path."}},"SetApiKeyIpsRequest":{"type":"object","additionalProperties":false,"required":["ips"],"properties":{"ips":{"type":"array","maxItems":50,"items":{"type":"string","format":"ip","description":"An IPv4 or IPv6 caller address."}}}}}},"User":{"type":"object","required":["id","name","email","role","emailVerified"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["user","admin"]},"emailVerified":{"type":"boolean"}}},"RegisterRequest":{"type":"object","additionalProperties":false,"required":["name","email","password"],"properties":{"name":{"type":"string","minLength":2,"maxLength":100},"email":{"type":"string","format":"email","maxLength":254},"password":{"type":"string","minLength":12,"maxLength":72}}},"LoginRequest":{"type":"object","additionalProperties":false,"required":["email","password"],"properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","minLength":1,"maxLength":72}}},"VerifyEmailRequest":{"type":"object","additionalProperties":false,"required":["otp"],"properties":{"otp":{"type":"string","pattern":"^\\d{6}$","description":"Six-digit, single-use code from the verification email."}}},"ResendVerificationRequest":{"type":"object","additionalProperties":false,"required":["email"],"properties":{"email":{"type":"string","format":"email"}}},"GoogleTokenRequest":{"type":"object","additionalProperties":false,"required":["idToken"],"properties":{"idToken":{"type":"string","description":"Google ID token obtained by the client."}}},"IpLookupRequest":{"type":"object","additionalProperties":false,"required":["ip"],"properties":{"ip":{"type":"string","format":"ip","description":"IPv4 or IPv6 address."}}},"IpLookupResponse":{"type":"object","properties":{"usage_id":{"type":"string","format":"uuid"},"credits_charged":{"type":"integer","example":1},"credits_remaining":{"type":"integer","example":99},"source":{"type":"string","enum":["redis","database","api"],"description":"Where this lookup result was retrieved from."},"success":{"type":"boolean","example":true},"message":{"type":"string"},"data":{"type":"object","required":["status","data"],"properties":{"status":{"type":"string","enum":["ok"]},"data":{"type":"object","required":["id","ip","lookup_left","last_updated","network","location","device_estimate","detections","is_modified"],"properties":{"id":{"type":"string"},"ip":{"type":"string","format":"ip"},"lookup_left":{"type":"integer"},"last_updated":{"type":"string","format":"date-time"},"network":{"type":"object","properties":{"asn":{"type":"string","nullable":true},"range":{"type":"string","nullable":true},"hostname":{"type":"string","nullable":true},"provider":{"type":"string","nullable":true},"organisation":{"type":"string","nullable":true},"type":{"type":"string","nullable":true}}},"location":{"type":"object","properties":{"continent_name":{"type":"string","nullable":true},"continent_code":{"type":"string","nullable":true},"country_name":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true},"region_name":{"type":"string","nullable":true},"region_code":{"type":"string","nullable":true},"city_name":{"type":"string","nullable":true},"postal_code":{"type":"string","nullable":true},"latitude":{"type":"number","nullable":true},"longitude":{"type":"number","nullable":true},"timezone":{"type":"string","nullable":true},"currency":{"type":"object","properties":{"code":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"symbol":{"type":"string","nullable":true}}}}},"device_estimate":{"type":"object","properties":{"address":{"type":"number"},"subnet":{"type":"number"}}},"detections":{"type":"object","required":["proxy","vpn","compromised","scraper","tor","hosting","anonymous","risk"],"properties":{"proxy":{"type":"boolean"},"vpn":{"type":"boolean"},"compromised":{"type":"boolean"},"scraper":{"type":"boolean"},"tor":{"type":"boolean"},"hosting":{"type":"boolean"},"anonymous":{"type":"boolean"},"risk":{"type":"number","minimum":0,"maximum":100}}},"is_modified":{"type":"integer"}}}}}}},"AuthResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string"},"data":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/User"},"accessToken":{"type":"string"},"tokenType":{"type":"string","example":"Bearer"},"expiresIn":{"type":"integer","example":900}}}}},"RegistrationResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string","example":"Registration successful. Check your email for a verification code."},"data":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/User"}}}}},"UserResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string"},"data":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/User"}}}}},"HealthResponse":{"type":"object","required":["success","message","data"],"properties":{"success":{"type":"boolean","example":true},"message":{"type":"string","example":"Server is running"},"data":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["ok"],"example":"ok"}}}}},"ReadinessResponse":{"type":"object","required":["success","message","data"],"properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","required":["database","redis","status"],"properties":{"database":{"type":"string","enum":["connected","unavailable"]},"redis":{"type":"string","enum":["connected","unavailable"]},"status":{"type":"string","enum":["ready","unavailable"]}}}}}}}}