Developers

SDKs

Integrate Mungfali with any HTTP client, or copy our thin wrapper patterns for Node.js and Python.

Mungfali is a REST API with one search endpoint. Most teams ship in under twenty lines using their language's standard HTTP library — no SDK required. The patterns below are starting points you can paste into your codebase.

REST-first integration

Endpoint: GET https://mungfali.net/v1/search

Authentication: X-API-Key: mgf_live_… or Authorization: Bearer mgf_live_…

See the API reference for parameters, response fields, and error codes.

Supported stacks

LanguageCommon librariesNotes
JavaScript / TypeScriptfetch, axios, gotNode 18+, browsers (via your backend)
Pythonrequests, httpx3.9+
PHPcURL, Guzzle8.0+
Gonet/http1.21+
RubyNet::HTTP, Faraday3.0+
JavaHttpClient, OkHttp11+
C# / .NETHttpClient.NET 6+

Node.js / TypeScript wrapper

Copy this module into your project, or adapt it for axios. Reads MUNGFALI_API_KEY from the environment.

javascript
// Thin wrapper pattern — no official package required
export async function searchImages(query, options = {}) {
  const params = new URLSearchParams({ q: query, ...options });
  const res = await fetch(`https://mungfali.net/v1/search?${params}`, {
    headers: { 'X-API-Key': process.env.MUNGFALI_API_KEY },
  });
  if (!res.ok) throw new Error((await res.json()).error || res.statusText);
  return res.json();
}
javascript
// Usage
const images = await searchImages('sunset', { count: 30, safesearch: 'strict' });
console.log(images.value[0].imageUrl);

Python wrapper

Minimal class around requests. Install with pip install requests.

python
# pip install requests — then wrap the REST call
class MungfaliClient:
    def __init__(self, api_key: str, base_url: str = "https://mungfali.net"):
        self.api_key = api_key
        self.search_url = f"{base_url}/v1/search"

    def search(self, q: str, **params):
        r = requests.get(
            self.search_url,
            params={"q": q, **params},
            headers={"X-API-Key": self.api_key},
            timeout=30,
        )
        r.raise_for_status()
        return r.json()
python
client = MungfaliClient(os.environ["MUNGFALI_API_KEY"])
result = client.search("car", count=50)
print(result["value"][0]["imageUrl"])

PHP

Use cURL or Guzzle with the same headers as curl. Full example on the Examples page.

php
<?php
$ch = curl_init('https://mungfali.net/v1/search?q=car&count=10');
curl_setopt_array($ch, [
    CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('MUNGFALI_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$body = curl_exec($ch);
$data = json_decode($body, true);
echo $data['value'][0]['imageUrl'];

Browser and mobile apps

Do not ship API keys in client-side apps. Route search requests through your backend (see the server-side proxy example on Examples).

OpenAPI and code generation

An OpenAPI 3 specification is on our roadmap so you can generate typed clients with OpenAPI Generator, Swagger Codegen, or Kiota. Until then, the API surface is intentionally small — one GET endpoint — so hand-written wrappers stay maintainable.

Official packages

We are prioritizing stable REST documentation and dashboard tooling before publishing npm/PyPI packages. Early customers can request dedicated wrapper support via contact.

  • Now: REST API + copy-paste wrappers (this page)
  • Planned: OpenAPI spec download, generated clients
  • Future: @mungfali/sdk on npm and mungfali on PyPI

Next steps