{
  "info": {
    "_postman_id": "9d5f6c2e-0f4a-4a1e-9c2b-0d0a0b0c0d0e",
    "name": "ODXProxy API",
    "description": "Unified JSON-RPC 2.0 API in front of one or more Odoo instances.\n\nSETUP: set the collection variables — `baseUrl`, `proxyApiKey` (the proxy's PROXY_API_KEY), and the `odoo*` target instance values.\n\nTWO DISTINCT SECRETS: `x-api-key` is the PROXY's key; `odoo_instance.api_key` is the Odoo USER's key. Never conflate them.\n\nHTTP 200 CAN STILL BE AN ERROR: an Odoo logic error returns HTTP 200 with a populated `error` object. Always check `error`, not just the status. Only proxy-layer failures use non-200 codes (401 -32000 auth, 400 -32001 bad action, 400 -32002 missing fn_name, 504 -32003 timeout, 502 -32004 bad gateway, 500 -32005 internal, 403 code 0 license invalid).\n\n9 ALLOWED ACTIONS: search_count, search, read, fields_get, search_read, create, write, unlink, call_method (call_method requires a non-empty fn_name). `params` is a JSON array (default []), `keyword` a JSON object (default {}).",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "RPC (require x-api-key)",
      "item": [
        {
          "name": "Execute — search_read",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{proxyApiKey}}",
                "description": "The PROXY's static API key (PROXY_API_KEY) — NOT the Odoo user key."
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "x-request-timeout",
                "value": "30",
                "disabled": true,
                "description": "Optional upstream Odoo timeout in whole seconds (default 15)."
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"id\": \"{{$guid}}\",\n  \"action\": \"search_read\",\n  \"model_id\": \"res.partner\",\n  \"params\": [\n    [\n      [\n        \"is_company\",\n        \"=\",\n        true\n      ]\n    ]\n  ],\n  \"keyword\": {\n    \"fields\": [\n      \"name\",\n      \"email\"\n    ],\n    \"limit\": 10\n  },\n  \"odoo_instance\": {\n    \"url\": \"{{odooUrl}}\",\n    \"db\": \"{{odooDb}}\",\n    \"user_id\": {{odooUserId}},\n    \"api_key\": \"{{odooApiKey}}\"\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/api/odoo/execute",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "odoo",
                "execute"
              ]
            },
            "description": "Runs execute_kw on the Odoo instance named in `odoo_instance`. Change `action` to any of the 9 allowed actions. For `call_method`, add a non-empty `fn_name` (see the next request)."
          },
          "response": []
        },
        {
          "name": "Execute — call_method",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{proxyApiKey}}",
                "description": "The PROXY's static API key (PROXY_API_KEY) — NOT the Odoo user key."
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "x-request-timeout",
                "value": "30",
                "disabled": true,
                "description": "Optional upstream Odoo timeout in whole seconds (default 15)."
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"id\": \"{{$guid}}\",\n  \"action\": \"call_method\",\n  \"model_id\": \"account.move\",\n  \"fn_name\": \"action_post\",\n  \"params\": [\n    [\n      42\n    ]\n  ],\n  \"keyword\": {},\n  \"odoo_instance\": {\n    \"url\": \"{{odooUrl}}\",\n    \"db\": \"{{odooDb}}\",\n    \"user_id\": {{odooUserId}},\n    \"api_key\": \"{{odooApiKey}}\"\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/api/odoo/execute",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "odoo",
                "execute"
              ]
            },
            "description": "`call_method` invokes an arbitrary Odoo model method named in `fn_name` (required, non-empty — omitting it returns HTTP 400 / code -32002). This is the escape hatch for anything outside the 8 direct actions."
          },
          "response": []
        },
        {
          "name": "Odoo version",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{proxyApiKey}}",
                "description": "The PROXY's static API key (PROXY_API_KEY) — NOT the Odoo user key."
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"id\": \"{{$guid}}\",\n  \"url\": \"{{odooUrl}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/api/odoo/version",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "odoo",
                "version"
              ]
            },
            "description": "Returns the target Odoo instance's public version_info. Body is just `{ id, url }` — no Odoo user credentials needed."
          },
          "response": []
        }
      ]
    },
    {
      "name": "Ops (no auth)",
      "item": [
        {
          "name": "License",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/_/license",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "_",
                "license"
              ]
            },
            "description": "Proxy license status. NOTE: a flat object ({ licensee, valid_until, is_valid }), NOT a JSON-RPC envelope."
          },
          "response": []
        },
        {
          "name": "About",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/_/about",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "_",
                "about"
              ]
            },
            "description": "Build info as a JSON-RPC envelope whose result is { build, version }."
          },
          "response": []
        },
        {
          "name": "Metrics",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/_/metrics",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "_",
                "metrics"
              ]
            },
            "description": "Prometheus text-format metrics."
          },
          "response": []
        }
      ]
    }
  ],
  "variable": [
    {
      "key": "baseUrl",
      "value": "http://localhost:3000",
      "type": "string"
    },
    {
      "key": "proxyApiKey",
      "value": "",
      "type": "string"
    },
    {
      "key": "odooUrl",
      "value": "https://erp.example.com",
      "type": "string"
    },
    {
      "key": "odooDb",
      "value": "prod",
      "type": "string"
    },
    {
      "key": "odooUserId",
      "value": "2",
      "type": "string"
    },
    {
      "key": "odooApiKey",
      "value": "",
      "type": "string"
    }
  ]
}
