Skip to content

Developers

Bring Hammick into your program or your AI agent

Hammick's foreign-trade tools (procurement landed cost, tariff classification and Mexican customs entry review) can be used in three ways: through the API with a key, through the MCP server, or paying each call with x402, with no account.

API with a key · MCP server · x402 payments · Reports and errors

Create an account and key

The basics

Base URL
https://api.hammick.ai. Everything is JSON over HTTPS.
Tools
POST /v1/consulta_procurement · POST /v1/clasificacion_arancelaria · POST /v1/glosa_pedimento. The body is always {"entrada": {…}}; files go in base64 (up to 25 MB).
Prices
GET /v1/precios returns the current price per tool, no key needed. Also in the store.
Result
Every call returns an indicative report (inf_…): it does not replace the signature of an authorised professional.

1 · API with a key

For companies and developers paying from prepaid credits (card, in USD).

  1. Create your free account at hammick.ai/en/sign-up and declare your country.
  2. Top up your credits in your account (Credits tab).
  3. In the Keys tab, create an hk_… key. It is shown only once: store it as a secret.
  4. Call the tool with Authorization: Bearer hk_…. The price is taken from your credits.
curl https://api.hammick.ai/v1/clasificacion_arancelaria \
  -H "Authorization: Bearer hk_..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 7f3c9a2e-0d1b-4c55-9a51-3e2f8b6d1c40" \
  -d '{"entrada": {"descripcion": "galvanized steel sheet in coils, 0.5 mm"}}'

Repeat a call with the same Idempotency-Key and it is not charged twice. For large customs entries, "asincrono": true returns the informe_id at once and you fetch the result later.

2 · MCP server

For AI assistants and agents that speak the Model Context Protocol. The server is remote (streamable HTTP, JSON-RPC) and uses the same key and credits as the API.

URL
https://api.hammick.ai/mcp
Authentication
Authorization: Bearer hk_… header on every request
Tools
consulta_procurement · clasificacion_arancelaria · glosa_pedimento · consultar_informe (fetches an asynchronous or pending report)
Billing
each tools/call is charged to your credits, exactly like the API

Configuration in an MCP client that supports headers:

{
  "mcpServers": {
    "hammick": {
      "type": "http",
      "url": "https://api.hammick.ai/mcp",
      "headers": { "Authorization": "Bearer hk_..." }
    }
  }
}

3 · Pay per call with x402

For agents with their own wallet: no account or key, each call is paid in USDC on Base with the x402 protocol (version 1, «exact» scheme).

  1. Call the tool without a key. You get 402 Payment Required with what to pay: a PAYMENT-REQUIRED header (base64) and the same object in the body.
  2. Your wallet signs the payment authorization (USDC, EIP-3009) for maxAmountRequired to payTo.
  3. Repeat the call with the X-PAYMENT header. The payment is verified and settled on-chain before the tool runs; the response carries the report and X-PAYMENT-RESPONSE with the transaction.

The 402 response (amounts in USDC units: 2000000 = 2 USD):

HTTP/1.1 402 Payment Required
PAYMENT-REQUIRED: eyJ4NDAyVmVyc2lvbiI6MSwiYWNjZXB0cyI6W3...

{
  "x402Version": 1,
  "accepts": [{
    "scheme": "exact",
    "network": "base",
    "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "maxAmountRequired": "2000000",
    "payTo": "0x…",
    "resource": "https://api.hammick.ai/v1/clasificacion_arancelaria",
    "maxTimeoutSeconds": 120
  }]
}

The paid call:

curl https://api.hammick.ai/v1/clasificacion_arancelaria \
  -H "X-PAYMENT: <signed paymentPayload, base64>" \
  -H "Content-Type: application/json" \
  -d '{"entrada": {"descripcion": "galvanized steel sheet in coils, 0.5 mm"}}'
  • The same X-PAYMENT sent twice is not charged twice: it returns the same report.
  • Do not send a key and a payment in the same request (400 pago_y_clave).
  • There is no asynchronous mode with x402. A customs entry with more than 20 lines is paid in two parts: the 402 response carries pagar with /v1/informes/<id>/pagar for the rest.
  • x402 payments are not available to accounts in Mexico: use a key with credits in pesos.
  • An on-chain payment cannot be undone by Hammick. If something was charged and not served, write to us and we refund it.

Reports and errors

Fetch a report
GET /v1/informes/<id> with your key (kept for 30 days). Over MCP, consultar_informe.
Credits
GET /v1/saldo with your key.
Errors
always the same shape; codigo is stable and mensaje can be shown to the user.
Status codes
400 invalid input · 401 missing or invalid key · 402 credits or payment needed · 404 not found · 409 conflict · 429 too many requests (retry later).
{"error": {"codigo": "saldo_insuficiente", "mensaje": "..."}}

Questions or need more volume? Write to admin@hammick.us.