# 4byte Function Selector Lookup

> 4byte Function Selector Lookup is a paid API for AI agents from api.gptshopltd.com, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-19).

Resolves a 4-byte EVM function selector (or full calldata) to its human-readable Solidity function signature(s)

## Facts

- Endpoint: GET https://api.gptshopltd.com/v1/evm/4byte?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-19
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/4byte-function-selector-lookup-492274b2
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_L8X704gYJ5b8vfypUovEC

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability 4byte-function-selector-lookup-492274b2
```

Example prompt: What Solidity function does the 4-byte selector 0xa9059cbb correspond to? Look it up against the 4byte.directory registry.

## When to prefer this

Use this endpoint when you need to decode an unknown EVM function selector or raw calldata prefix into a human-readable Solidity function signature, especially during transaction analysis, smart contract auditing, or MEV research. It aggregates multiple sources including 4byte.directory and Sourcify and flags verified contracts, making it more reliable than querying a single registry. No API key or account setup required — pay per call via USDC on Base or Solana.

## Known failure modes

- Selector not found in registry — returns found:false with empty matches array
- Malformed selector (not 0x-prefixed or wrong length) — likely 400 or validation error
- Multiple ambiguous matches with no clear best — returns count>1 but may not reliably identify the intended function
- Payment not processed via x402 — 402 response before result is returned

## How this service works

Pay-per-call tools for AI agents. USDC on Base or Solana via x402 v2; no keys, no accounts.

## Output

Returns a JSON object with the best-matching human-readable Solidity function signature, the total count of matches found, a boolean indicating whether any match was found, a list of match objects each containing function name, full signature, source registries (e.g. 4byte.directory, Sourcify), and whether it comes from a verified contract, plus the original selector queried.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "selector"
     ],
     "properties": {
      "selector": {
       "type": "string",
       "description": "4-byte function selector (0x + 8 hex chars) or full calldata; only the first 4 bytes are used"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "best": "transfer(address,uint256)",
  "count": 6,
  "found": true,
  "matches": [
   {
    "name": "transfer",
    "sources": [
     "sourcify",
     "4byte.directory"
    ],
    "signature": "transfer(address,uint256)",
    "verifiedContract": true
   }
  ],
  "selector": "0xa9059cbb"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/4byte-function-selector-lookup-492274b2/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.gptshopltd.com](https://www.zero.xyz/host/api.gptshopltd.com/llms.txt)
