Skip to content
OSINTtools.io

FOFA API

Chinese cyberspace mapping engine for finding hosts and web assets by banner, certificate, title or favicon.

Base URL
https://en.fofa.info/api/v1
Sign-in
API key
Format
REST
Endpoints
5

Compiled by OSINTtools.io editors from en.fofa.info · updated Nov 29, 2026Work on this API? Claim it to keep these docs currentReport a mistake

Introduction

FOFA is a search engine over internet-facing assets. Its API runs FOFA query syntax and returns matching hosts with fields such as IP, port, protocol, domain, title, server, ASN, certificate details and JARM fingerprint. It also returns top-5 statistics for a query and a per-host summary of ports, protocols and products. An investigator uses it to find assets that share a certificate, title, favicon or fingerprint, or to see what a host exposes.

Calls are HTTPS GET requests (UTF-8) to https://en.fofa.info/api/v1/... with your API key in the key query parameter. Queries are sent base64-encoded in qbase64. Some response fields (for example product, icon_hash, body) need a higher membership level; the docs list the level required for each field.

The docs ask you to keep the request rate below 2 per second, and the statistics and host aggregation endpoints have their own concurrency limits (one request per 5 seconds and one per second). Aggregation access depends on membership level; see the pricing page.

The docs are a JavaScript page; this reference was read from the rendered page on 2026-11-29.

Quick start

  1. Get a key

    Create an account with FOFA and copy your api key. Where to get it

  2. Make your first request

    Search hosts with a FOFA query and return the chosen fields.. Replace YOUR_API_KEY and run it in a terminal, or use Try it on the endpoint.

    curl 'https://en.fofa.info/api/v1/search/all?qbase64=aXA9IjE5OC41MS4xMDAuNyI%3D&key=YOUR_API_KEY'
  3. Read the response

    A 200 response looks like this.

    {
      "error": false,
      "size": 2,
      "page": 1,
      "mode": "extended",
      "query": "ip=\"198.51.100.7\"",
      "results": [
        [
          "198.51.100.7",
          "198.51.100.7",
          "80"
        ],
        [
          "https://www.example.com",
          "198.51.100.7",
          "443"
        ]
      ]
    }

Authentication

Send your API key in the key query parameter of every request.

The API key is on the account page.

Get a key from FOFA

Try it on this page keeps your key in your browser; it is never sent to OSINTtools.io.

Rate limits and pricing

Keep requests below 2 per second. Statistic aggregation: one request per 5 seconds. Host aggregation: one request per second.

  • Registered UserFree · 300 query credits/month, 3k results/month, 44 search syntaxes
  • Personal$25/month · 10,000 query credits/month, up to 100k results/month, 60 syntaxes, API 1 req/s
  • Professional$119/month · 80,000 query credits/month, up to 800k results/month, 62 syntaxes, API 1 req/s
  • Business$1,199/month · 900,000 query credits/month, up to 9M results/month, all syntaxes, 5 users, API 2 req/s
  • Corporate V2Contact sales · Custom credits (5M web + 5M API/month), all syntaxes, API 5 req/s, custom users

Plans from en.fofa.info, checked Nov 25, 2026.

Errors

StatusMeaning
200Failures are reported in the body with error set to true

The query is base64-encoded in qbase64. Results are sorted by update time and are returned as arrays of the requested fields, in the order given in fields. With full unset, only results within one year are returned. When the query contains cert or banner the maximum size is 2000 per page; when it contains body, 500.

Query parameters

qbase64stringrequiredtakes your ip address

The FOFA query syntax, base64-encoded

Example: aXA9IjE5OC41MS4xMDAuNyI=
fieldsstring

Comma-separated fields to return (see Appendix 1 of the docs: ip, port, protocol, country, region, city, asn, org, host, domain, os, server, title, jarm, header, banner, cert, link, status_code and more; some need a paid level)

Example: host,ip,portDefault: host,ip,port
pageinteger

Page number, sorted by update time

Example: 1Default: 1
sizeinteger

Results per page (maximum 10,000)

Example: 100Default: 100
fullboolean

true searches all results instead of only the last year

Example: falseDefault: false
r_typestring

Set to json to return data in JSON format

Example: json
Response fields · 6Show

errorboolean

Whether the request failed

sizeinteger

Total number of results for the query

pageinteger

Page number

modestring

Query mode

querystring

The query syntax that was run

results[]array

One array per result with the requested fields in order

curl 'https://en.fofa.info/api/v1/search/all?qbase64=aXA9IjE5OC41MS4xMDAuNyI%3D&key=YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "error": false,
  "size": 2,
  "page": 1,
  "mode": "extended",
  "query": "ip=\"198.51.100.7\"",
  "results": [
    [
      "198.51.100.7",
      "198.51.100.7",
      "80"
    ],
    [
      "https://www.example.com",
      "198.51.100.7",
      "443"
    ]
  ]
}

Avoids data misalignment from page-based paging. Each response returns an id for the next request; pass it as next. An empty next starts the query again. Supports retrying failures.

Query parameters

qbase64stringrequiredtakes your ip address

The FOFA query syntax, base64-encoded

Example: aXA9IjE5OC41MS4xMDAuNyI=
fieldsstring

Comma-separated fields to return

Example: host,ip,portDefault: host,ip,port
sizeinteger

Results per page (maximum 10,000)

Example: 100Default: 100
nextstring

The id of the next query returned by the previous response; empty re-queries from the start

fullboolean

true searches all results instead of only the last year

Example: falseDefault: false
r_typestring

Set to json to return data in JSON format

Example: json
Response fields · 4Show

errorboolean

Whether the request failed

sizeinteger

Total number of results

querystring

The query syntax that was run

results[]array

One array per result with the requested fields in order

curl 'https://en.fofa.info/api/v1/search/next?qbase64=aXA9IjE5OC41MS4xMDAuNyI%3D&key=YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "error": false,
  "size": 1,
  "mode": "extended",
  "query": "ip=\"198.51.100.7\"",
  "results": [
    [
      "198.51.100.7",
      "198.51.100.7",
      "80"
    ]
  ]
}

Aggregation

Limited to one request per 5 seconds. Returns distinct counts (supported for server, domain, title, fidv2) and aggregates per requested field. Access depends on membership level.

Query parameters

qbase64stringrequiredtakes your ip address

The FOFA query syntax, base64-encoded

Example: aXA9IjE5OC41MS4xMDAuNyI=
fieldsstring

Comma-separated fields to aggregate: protocol, domain, port, title, os, server, country, asn, org, asset_type, fidv2, icp

Example: protocol,port
Response fields · 5Show

errorboolean

Whether the request failed

ipinteger

Distinct count

namestring

Value (one aggregate list per requested field)

countinteger

Number of results with that value

lastupdatetimestring

Time of the last update

curl 'https://en.fofa.info/api/v1/search/stats?qbase64=aXA9IjE5OC41MS4xMDAuNyI%3D&key=YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "error": false,
  "distinct": {
    "ip": 12,
    "title": 3
  },
  "aggs": {
    "title": [
      {
        "count": 8,
        "name": "Example Domain"
      },
      {
        "count": 2,
        "name": "Welcome"
      }
    ]
  },
  "lastupdatetime": "2026-01-01 00:00:00"
}

Limited to one request per second. With detail=false, lists of ports, protocols, categories and products; with detail=true, each port with its protocol and products. Access depends on membership level.

Path parameters

hoststringrequiredtakes your ip address

Host name, usually an IP

Example: 198.51.100.7

Query parameters

detailboolean

View the port details

Example: falseDefault: false
Response fields · 14Show

errorboolean

Whether the request failed

hoststring

Host looked up

ipstring

IP address

asninteger

ASN number

orgstring

ASN organization

country_namestring

Country name

country_codestring

Country code

protocol[]string

Protocols seen (detail=false)

port[]integer

Ports seen (detail=false)

category[]string

Product category labels (detail=false)

product[]string

Product labels (detail=false)

portinteger

Port (detail=true)

protocolstring

Protocol on that port (detail=true)

update_timestring

Time of the data

curl 'https://en.fofa.info/api/v1/host/198.51.100.7?key=YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "error": false,
  "host": "198.51.100.7",
  "ip": "198.51.100.7",
  "asn": 64500,
  "org": "Example Networks",
  "country_name": "Germany",
  "country_code": "DE",
  "protocol": [
    "https",
    "http"
  ],
  "port": [
    443,
    80
  ],
  "category": [
    "Web Server"
  ],
  "product": [
    "NGINX"
  ],
  "update_time": "2026-01-01 00:00:00"
}

Account

  • Passive: the target is not contacted

Returns account details for the key. It does not query data.

Response fields · 9Show

errorboolean

Whether the request failed

usernamestring

User name

categorystring

User category

fofa_pointinteger

F points

remain_free_pointinteger

Remaining free F points

remain_api_queryinteger

Remaining monthly API queries

remain_api_datainteger

Remaining monthly returned results

isvipboolean

Whether the account is a member

vip_levelinteger

Membership level

curl 'https://en.fofa.info/api/v1/info/my?key=YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "error": false,
  "username": "example-user",
  "category": "user",
  "fofa_point": 100,
  "remain_free_point": 0,
  "remain_api_query": 1000,
  "remain_api_data": 10000,
  "isvip": true,
  "vip_level": 1
}