{
  "openapi": "3.1.0",
  "info": {
    "title": "Agent Bits",
    "version": "0.3.0",
    "description": "Machine-readable utilities and datasets for AI agents.",
    "contact": {
      "url": "https://agentbits.dev"
    }
  },
  "servers": [
    {
      "url": "https://agentbits.dev",
      "description": "Canonical Agent Bits service"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "operationId": "health",
        "summary": "Service health",
        "responses": {
          "200": {
            "description": "Service is reachable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "name": {
                      "type": "string",
                      "example": "Agent Bits"
                    }
                  },
                  "required": [
                    "status",
                    "name"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/base64/decode": {
      "post": {
        "operationId": "base64_decode",
        "summary": "Decode a Base64 string into UTF-8 text and report invalid payloads as errors when recovering embedded credentials, tokens, or transport-encoded content.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "decoded": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "decoded"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string",
                    "description": "Base64 text to decode"
                  }
                },
                "required": [
                  "value"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/base64/encode": {
      "post": {
        "operationId": "base64_encode",
        "summary": "Convert a UTF-8 string into standard Base64 when you need a portable text encoding for credentials, binary-safe transport, or embedding data in JSON/HTTP fields.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "encoded": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "encoded"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string",
                    "description": "Text to encode"
                  }
                },
                "required": [
                  "value"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/datasets/countries/v1.json": {
      "get": {
        "operationId": "countries_bulk",
        "summary": "Download the complete versioned countries dataset as JSON for caching, offline use, or multi-country analysis when a single country_lookup call is not enough.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "dataset": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "revision": {
                      "type": "string"
                    },
                    "generated": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "records": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "code3": {
                            "type": "string"
                          },
                          "numeric": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "official_name": {
                            "type": "string"
                          },
                          "region": {
                            "type": "string"
                          },
                          "subregion": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "calling_code": {
                            "type": "string"
                          },
                          "languages": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "code",
                          "code3",
                          "numeric",
                          "name",
                          "official_name",
                          "region",
                          "subregion",
                          "currency",
                          "calling_code",
                          "languages"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "dataset",
                    "version",
                    "revision",
                    "generated",
                    "count",
                    "records"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "402": {
            "description": "Payment required"
          }
        },
        "parameters": [
          {
            "name": "version",
            "in": "query",
            "required": true,
            "schema": {
              "default": "1",
              "description": "Dataset version to retrieve. Defaults to 1.",
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/countries/{code}": {
      "get": {
        "operationId": "country_lookup",
        "summary": "Resolve an ISO 3166-1 alpha-2 country code (for example CA, US, JP) to official name, region, currency, calling code, languages, and related country metadata when you already have the two-letter code.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "code3": {
                      "type": "string"
                    },
                    "numeric": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "official_name": {
                      "type": "string"
                    },
                    "region": {
                      "type": "string"
                    },
                    "subregion": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "calling_code": {
                      "type": "string"
                    },
                    "languages": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "dataset_version": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "code3",
                    "numeric",
                    "name",
                    "official_name",
                    "region",
                    "subregion",
                    "currency",
                    "calling_code",
                    "languages",
                    "dataset_version"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 2,
              "pattern": "^[A-Za-z]{2}$",
              "description": "ISO 3166-1 alpha-2 country code, for example CA or JP"
            }
          }
        ]
      }
    },
    "/v1/currencies/{code}": {
      "get": {
        "operationId": "currency_lookup",
        "summary": "Resolve an ISO 4217 currency code such as USD, EUR, or JPY to its name, symbol, decimal places, and which countries use it when you need currency metadata rather than a live exchange rate.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "symbol": {
                      "type": "string"
                    },
                    "decimals": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "countries": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "dataset_version": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "name",
                    "symbol",
                    "decimals",
                    "countries",
                    "dataset_version"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 3,
              "maxLength": 3
            }
          }
        ]
      }
    },
    "/v1/http-status/{code}": {
      "get": {
        "operationId": "http_status_lookup",
        "summary": "Explain what a numeric HTTP status code such as 404 or 429 means by returning its standard reason phrase and a short description for debugging or API responses.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "name",
                    "description"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 100,
              "maximum": 599
            }
          }
        ]
      }
    },
    "/v1/isbn/validate": {
      "post": {
        "operationId": "isbn_validate",
        "summary": "Verify whether an ISBN-10 or ISBN-13 passes checksum rules and return normalized digits when checking book identifiers before catalog or purchase flows.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "valid": {
                      "type": "boolean"
                    },
                    "type": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "isbn10",
                            "isbn13"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "normalized": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "valid",
                    "type",
                    "normalized"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string",
                    "description": "ISBN-10 or ISBN-13 candidate"
                  }
                },
                "required": [
                  "value"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/json/validate": {
      "post": {
        "operationId": "json_validate",
        "summary": "Parse a string as JSON to confirm it is well-formed and return a normalized representation when possible before further processing or storage.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "valid": {
                      "type": "boolean"
                    },
                    "normalized": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "error": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "valid",
                    "normalized",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string"
                  }
                },
                "required": [
                  "value"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/languages/{code}": {
      "get": {
        "operationId": "language_lookup",
        "summary": "Resolve an ISO 639-1 language code such as en, fr, or ja to its English name and native name when you need language metadata from a two-letter code.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "native_name": {
                      "type": "string"
                    },
                    "dataset_version": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "name",
                    "native_name",
                    "dataset_version"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 3
            }
          }
        ]
      }
    },
    "/v1/luhn/validate": {
      "post": {
        "operationId": "luhn_validate",
        "summary": "Run the Luhn checksum on a numeric string such as a payment-card-like identifier to verify the check digit before accepting or storing the value.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "valid": {
                      "type": "boolean"
                    },
                    "normalized": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "valid",
                    "normalized"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string",
                    "description": "Numeric string to validate with Luhn"
                  }
                },
                "required": [
                  "value"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/mime/lookup": {
      "post": {
        "operationId": "mime_lookup",
        "summary": "Map a file extension such as webp or png, or a MIME type string, to curated Content-Type metadata when setting headers, validating uploads, or choosing a media type.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "extension": {
                      "type": "string"
                    },
                    "mime": {
                      "type": "string"
                    },
                    "compressible": {
                      "type": "boolean"
                    },
                    "dataset_version": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "extension",
                    "mime",
                    "compressible",
                    "dataset_version"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "query"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/timestamp/convert": {
      "post": {
        "operationId": "timestamp_convert",
        "summary": "Convert Unix epoch seconds or milliseconds to ISO-8601, or an ISO-8601 datetime to Unix epoch values, when bridging APIs that disagree on time formats.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "iso": {
                      "type": "string"
                    },
                    "unix_seconds": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "unix_milliseconds": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "iso",
                    "unix_seconds",
                    "unix_milliseconds"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string",
                    "description": "Unix timestamp or ISO-8601 datetime"
                  },
                  "input_format": {
                    "type": "string",
                    "enum": [
                      "unix_seconds",
                      "unix_milliseconds",
                      "iso8601"
                    ],
                    "description": "Format of value"
                  }
                },
                "required": [
                  "value",
                  "input_format"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/timezone/convert": {
      "post": {
        "operationId": "timezone_convert",
        "summary": "Convert an ISO-8601 datetime from one IANA timezone to another while preserving the same instant, including daylight-saving-aware wall times such as Toronto to Tokyo.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "type": "object",
                      "properties": {
                        "datetime": {
                          "type": "string"
                        },
                        "timezone": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "datetime",
                        "timezone"
                      ],
                      "additionalProperties": false
                    },
                    "target": {
                      "type": "object",
                      "properties": {
                        "datetime": {
                          "type": "string"
                        },
                        "timezone": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "datetime",
                        "timezone"
                      ],
                      "additionalProperties": false
                    },
                    "utc": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "source",
                    "target",
                    "utc"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "datetime": {
                    "type": "string",
                    "description": "ISO-8601 datetime, with or without offset"
                  },
                  "from_timezone": {
                    "type": "string",
                    "description": "IANA timezone for interpreting naive datetimes"
                  },
                  "to_timezone": {
                    "type": "string",
                    "description": "IANA timezone for output"
                  }
                },
                "required": [
                  "datetime",
                  "from_timezone",
                  "to_timezone"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/tlds/{tld}": {
      "get": {
        "operationId": "tld_lookup",
        "summary": "Identify what a DNS top-level domain such as com, io, or ai is classified as and commonly used for when classifying domains or answering TLD questions.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tld": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "tld",
                    "type",
                    "description"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "tld",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 2
            }
          }
        ]
      }
    },
    "/v1/unit/convert": {
      "post": {
        "operationId": "unit_convert",
        "summary": "Convert a numeric value between supported length, mass, or temperature units—for example miles to kilometers or Celsius to Fahrenheit—when you need a deterministic unit conversion.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "value": {
                      "type": "number"
                    },
                    "from_unit": {
                      "type": "string"
                    },
                    "to_unit": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "value",
                    "from_unit",
                    "to_unit"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "number"
                  },
                  "from_unit": {
                    "type": "string"
                  },
                  "to_unit": {
                    "type": "string"
                  }
                },
                "required": [
                  "value",
                  "from_unit",
                  "to_unit"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/url/decode": {
      "post": {
        "operationId": "url_decode",
        "summary": "Decode a percent-encoded URL component into plain text when reading query parameters, path segments, or form values that contain escaped characters.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "decoded": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "decoded"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string"
                  }
                },
                "required": [
                  "value"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/url/encode": {
      "post": {
        "operationId": "url_encode",
        "summary": "Apply encodeURIComponent-style percent-encoding so query parameters, path segments, or form values are safe to place in a URL.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "encoded": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "encoded"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string"
                  }
                },
                "required": [
                  "value"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/uuid/validate": {
      "post": {
        "operationId": "uuid_validate",
        "summary": "Check whether a string is a well-formed UUID and, when recognizable, report its version and variant so you can accept or reject identifier inputs confidently.",
        "tags": [
          "tool"
        ],
        "responses": {
          "200": {
            "description": "Successful capability response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "valid": {
                      "type": "boolean"
                    },
                    "version": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "variant": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "normalized": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "valid",
                    "version",
                    "variant",
                    "normalized"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string",
                    "description": "UUID candidate string"
                  }
                },
                "required": [
                  "value"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "tool",
      "description": "Deterministic utilities and lookups"
    },
    {
      "name": "dataset",
      "description": "Curated static datasets"
    },
    {
      "name": "integration",
      "description": "External API integrations"
    }
  ]
}
