# FOFA API reference

> 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,…

Source: https://osinttools.io/apis/fofa/ (Markdown view of an OSINTtools.io page; append `.md` to any page URL for this format).

Compiled by OSINTtools.io editors from the vendor's docs, updated Nov 29, 2026. Listing: https://osinttools.io/tools/fofa/

- Base URL: https://en.fofa.info/api/v1
- Authentication: API key in the `key` query parameter. Get a key: https://en.fofa.info The API key is on the account page.
- Rate limits: Keep requests below 2 per second. Statistic aggregation: one request per 5 seconds. Host aggregation: one request per second.
- Vendor docs: https://en.fofa.info/api

## Overview

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.

## Errors

| Status | Meaning |
| --- | --- |
| 200 | Failures are reported in the body with error set to true |

## Search

### Search hosts with a FOFA query and return the chosen fields.

`GET /search/all`

- Takes: IP address, Domain
- Footprint: passive (the target is not contacted)

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.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `qbase64` | query | string | yes | The FOFA query syntax, base64-encoded Example: aXA9IjE5OC41MS4xMDAuNyI= |
| `fields` | query | string | no | 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,port |
| `page` | query | integer | no | Page number, sorted by update time Example: 1 |
| `size` | query | integer | no | Results per page (maximum 10,000) Example: 100 |
| `full` | query | boolean | no | true searches all results instead of only the last year Example: false |
| `r_type` | query | string | no | Set to json to return data in JSON format Example: json |

Response fields:

- `error` (boolean): Whether the request failed
- `size` (integer): Total number of results for the query
- `page` (integer): Page number
- `mode` (string): Query mode
- `query` (string): The query syntax that was run
- `results[]` (array): One array per result with the requested fields in order

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

Example response (200):

```json
{
  "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"
    ]
  ]
}
```

### Continuous pagination for large result sets of one query.

`GET /search/next`

- Takes: IP address, Domain
- Footprint: passive (the target is not contacted)

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.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `qbase64` | query | string | yes | The FOFA query syntax, base64-encoded Example: aXA9IjE5OC41MS4xMDAuNyI= |
| `fields` | query | string | no | Comma-separated fields to return Example: host,ip,port |
| `size` | query | integer | no | Results per page (maximum 10,000) Example: 100 |
| `next` | query | string | no | The id of the next query returned by the previous response; empty re-queries from the start |
| `full` | query | boolean | no | true searches all results instead of only the last year Example: false |
| `r_type` | query | string | no | Set to json to return data in JSON format Example: json |

Response fields:

- `error` (boolean): Whether the request failed
- `size` (integer): Total number of results
- `query` (string): The query syntax that was run
- `results[]` (array): One array per result with the requested fields in order

```bash
curl 'https://en.fofa.info/api/v1/search/next?qbase64=aXA9IjE5OC41MS4xMDAuNyI%3D&key=YOUR_API_KEY'
```

Example response (200):

```json
{
  "error": false,
  "size": 1,
  "mode": "extended",
  "query": "ip=\"198.51.100.7\"",
  "results": [
    [
      "198.51.100.7",
      "198.51.100.7",
      "80"
    ]
  ]
}
```

## Aggregation

### Top-5 statistics per field for a query's results.

`GET /search/stats`

- Takes: IP address, Domain
- Footprint: passive (the target is not contacted)

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.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `qbase64` | query | string | yes | The FOFA query syntax, base64-encoded Example: aXA9IjE5OC41MS4xMDAuNyI= |
| `fields` | query | string | no | Comma-separated fields to aggregate: protocol, domain, port, title, os, server, country, asn, org, asset_type, fidv2, icp Example: protocol,port |

Response fields:

- `error` (boolean): Whether the request failed
- `distinct.ip` (integer): Distinct count
- `aggs.title[].name` (string): Value (one aggregate list per requested field)
- `aggs.title[].count` (integer): Number of results with that value
- `lastupdatetime` (string): Time of the last update

```bash
curl 'https://en.fofa.info/api/v1/search/stats?qbase64=aXA9IjE5OC41MS4xMDAuNyI%3D&key=YOUR_API_KEY'
```

Example response (200):

```json
{
  "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"
}
```

### Ports, protocols, domains, categories and products seen on one host.

`GET /host/{host}`

- Takes: IP address, Domain
- Footprint: passive (the target is not contacted)

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.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `host` | path | string | yes | Host name, usually an IP Example: 198.51.100.7 |
| `detail` | query | boolean | no | View the port details Example: false |

Response fields:

- `error` (boolean): Whether the request failed
- `host` (string): Host looked up
- `ip` (string): IP address
- `asn` (integer): ASN number
- `org` (string): ASN organization
- `country_name` (string): Country name
- `country_code` (string): 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)
- `ports[].port` (integer): Port (detail=true)
- `ports[].protocol` (string): Protocol on that port (detail=true)
- `update_time` (string): Time of the data

```bash
curl 'https://en.fofa.info/api/v1/host/198.51.100.7?key=YOUR_API_KEY'
```

Example response (200):

```json
{
  "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

### Account status: membership level, points and remaining API queries.

`GET /info/my`

- Footprint: passive (the target is not contacted)

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

Response fields:

- `error` (boolean): Whether the request failed
- `username` (string): User name
- `category` (string): User category
- `fofa_point` (integer): F points
- `remain_free_point` (integer): Remaining free F points
- `remain_api_query` (integer): Remaining monthly API queries
- `remain_api_data` (integer): Remaining monthly returned results
- `isvip` (boolean): Whether the account is a member
- `vip_level` (integer): Membership level

```bash
curl 'https://en.fofa.info/api/v1/info/my?key=YOUR_API_KEY'
```

Example response (200):

```json
{
  "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
}
```

---

Listings on OSINTtools.io are reviewed by editors and re-verified on a schedule; check pricing and availability on the vendor's site before relying on them, and use OSINT tools only with a lawful basis.
Site index for agents: https://osinttools.io/llms.txt · Full catalog: https://osinttools.io/llms-full.txt · MCP server (Streamable HTTP, no auth): https://osinttools.io/mcp/
