{
  "info": {
    "name": "Law Hired API",
    "description": "Complete collection for the Law Hired REST API v1.\n\n**Setup:**\n1. Import this collection into Postman\n2. Set the `LAWHIRED_API_KEY` environment variable to your key (create at https://www.lawhired.com/lawyer/api-keys)\n3. All requests use `{{base_url}}` and `{{api_key}}` — both are pre-configured\n\n**Base URL:** https://www.lawhired.com/api/v1\n\n**Auth:** Bearer token (your `lh_live_…` key)",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "version": "1.0.0"
  },
  "variable": [
    { "key": "base_url", "value": "https://www.lawhired.com/api/v1", "type": "string" },
    { "key": "api_key", "value": "lh_live_YOUR_KEY_HERE", "type": "string" }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [{ "key": "token", "value": "{{api_key}}", "type": "string" }]
  },
  "item": [
    {
      "name": "Identity",
      "item": [
        {
          "name": "Get API key identity",
          "request": {
            "method": "GET",
            "header": [],
            "url": { "raw": "{{base_url}}/me", "host": ["{{base_url}}"], "path": ["me"] },
            "description": "Returns the authenticated key's name, environment, scopes, rate tier, and owner UUID."
          }
        }
      ]
    },
    {
      "name": "Matters",
      "item": [
        {
          "name": "List matters",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{base_url}}/matters?limit=50&offset=0",
              "host": ["{{base_url}}"], "path": ["matters"],
              "query": [
                { "key": "limit", "value": "50", "description": "Max records (up to 200)" },
                { "key": "offset", "value": "0" },
                { "key": "updated_since", "value": "2024-01-01T00:00:00Z", "description": "Delta sync — return only records changed since", "disabled": true }
              ]
            }
          }
        },
        {
          "name": "Get a matter",
          "request": {
            "method": "GET",
            "url": { "raw": "{{base_url}}/matters/1", "host": ["{{base_url}}"], "path": ["matters", "1"] }
          }
        },
        {
          "name": "Create a matter",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"title\": \"Smith v. Jones\",\n  \"description\": \"Personal injury — auto accident\",\n  \"case_category\": \"Litigation\",\n  \"status\": \"In Progress\",\n  \"client_id\": 1,\n  \"start_date\": \"2024-03-01\"\n}"
            },
            "url": { "raw": "{{base_url}}/matters", "host": ["{{base_url}}"], "path": ["matters"] }
          }
        },
        {
          "name": "Upsert a matter by external_id (ERP sync)",
          "request": {
            "method": "PUT",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"external_id\": \"ERP-MATTER-001\",\n  \"title\": \"Smith v. Jones\",\n  \"status\": \"In Progress\",\n  \"client_id\": 1\n}"
            },
            "url": { "raw": "{{base_url}}/matters", "host": ["{{base_url}}"], "path": ["matters"] },
            "description": "Creates or updates — safe to call repeatedly with the same external_id"
          }
        },
        {
          "name": "Update a matter",
          "request": {
            "method": "PATCH",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"status\": \"Case Won\"\n}" },
            "url": { "raw": "{{base_url}}/matters/1", "host": ["{{base_url}}"], "path": ["matters", "1"] }
          }
        },
        {
          "name": "Delete a matter",
          "request": {
            "method": "DELETE",
            "url": { "raw": "{{base_url}}/matters/1", "host": ["{{base_url}}"], "path": ["matters", "1"] }
          }
        }
      ]
    },
    {
      "name": "Clients",
      "item": [
        {
          "name": "List clients",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{base_url}}/clients?limit=50",
              "host": ["{{base_url}}"], "path": ["clients"],
              "query": [
                { "key": "limit", "value": "50" },
                { "key": "offset", "value": "0" },
                { "key": "updated_since", "value": "", "disabled": true }
              ]
            }
          }
        },
        {
          "name": "Get a client",
          "request": { "method": "GET", "url": { "raw": "{{base_url}}/clients/1", "host": ["{{base_url}}"], "path": ["clients", "1"] } }
        },
        {
          "name": "Create a client",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"company_name\": \"Acme Corp\",\n  \"contact_person\": \"Jane Doe\",\n  \"email\": \"jane@acme.com\",\n  \"phone\": \"+1-555-0123\",\n  \"client_type\": \"business\",\n  \"status\": \"active\"\n}"
            },
            "url": { "raw": "{{base_url}}/clients", "host": ["{{base_url}}"], "path": ["clients"] }
          }
        },
        {
          "name": "Upsert a client by external_id (CRM sync)",
          "request": {
            "method": "PUT",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"external_id\": \"HUBSPOT-CONTACT-123\",\n  \"company_name\": \"Acme Corp\",\n  \"email\": \"ap@acme.com\",\n  \"client_type\": \"business\"\n}"
            },
            "url": { "raw": "{{base_url}}/clients", "host": ["{{base_url}}"], "path": ["clients"] }
          }
        },
        {
          "name": "Update a client",
          "request": {
            "method": "PATCH",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"status\": \"inactive\"\n}" },
            "url": { "raw": "{{base_url}}/clients/1", "host": ["{{base_url}}"], "path": ["clients", "1"] }
          }
        },
        {
          "name": "Delete a client",
          "request": { "method": "DELETE", "url": { "raw": "{{base_url}}/clients/1", "host": ["{{base_url}}"], "path": ["clients", "1"] } }
        }
      ]
    },
    {
      "name": "Time Entries",
      "item": [
        {
          "name": "List time entries",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{base_url}}/time-entries?limit=50",
              "host": ["{{base_url}}"], "path": ["time-entries"],
              "query": [{ "key": "limit", "value": "50" }, { "key": "updated_since", "value": "", "disabled": true }]
            }
          }
        },
        {
          "name": "Create a time entry",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"case_id\": 1,\n  \"description\": \"Draft motion for summary judgment\",\n  \"duration\": 2.5,\n  \"is_billable\": true,\n  \"rate\": 350.00,\n  \"activity_type\": \"Research\"\n}"
            },
            "url": { "raw": "{{base_url}}/time-entries", "host": ["{{base_url}}"], "path": ["time-entries"] }
          }
        },
        {
          "name": "Upsert a time entry by external_id",
          "request": {
            "method": "PUT",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"external_id\": \"TIMEKEEPING-789\",\n  \"case_id\": 1,\n  \"description\": \"Client call\",\n  \"duration\": 0.5,\n  \"is_billable\": true,\n  \"rate\": 350.00\n}"
            },
            "url": { "raw": "{{base_url}}/time-entries", "host": ["{{base_url}}"], "path": ["time-entries"] }
          }
        }
      ]
    },
    {
      "name": "Invoices",
      "item": [
        {
          "name": "List invoices",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{base_url}}/invoices?limit=50",
              "host": ["{{base_url}}"], "path": ["invoices"],
              "query": [{ "key": "limit", "value": "50" }, { "key": "updated_since", "value": "", "disabled": true }]
            },
            "description": "Invoices are read-only via the API. Write-back is handled through QuickBooks or Xero sync."
          }
        },
        {
          "name": "Get an invoice",
          "request": { "method": "GET", "url": { "raw": "{{base_url}}/invoices/1", "host": ["{{base_url}}"], "path": ["invoices", "1"] } }
        }
      ]
    },
    {
      "name": "Leads",
      "item": [
        {
          "name": "Capture a lead",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"leadData\": {\n    \"first_name\": \"John\",\n    \"last_name\": \"Doe\",\n    \"email\": \"john.doe@email.com\",\n    \"phone\": \"+1-555-0123\",\n    \"practice_area\": \"Family Law\",\n    \"description\": \"Need help with custody dispute\",\n    \"urgency\": \"high\"\n  }\n}"
            },
            "url": { "raw": "{{base_url}}/leads", "host": ["{{base_url}}"], "path": ["leads"] }
          }
        },
        {
          "name": "List leads (API key-scoped)",
          "request": {
            "method": "GET",
            "url": { "raw": "{{base_url}}/leads?limit=25", "host": ["{{base_url}}"], "path": ["leads"], "query": [{ "key": "limit", "value": "25" }] }
          }
        }
      ]
    },
    {
      "name": "Webhooks",
      "item": [
        {
          "name": "List webhook endpoints",
          "request": { "method": "GET", "url": { "raw": "{{base_url}}/webhooks", "host": ["{{base_url}}"], "path": ["webhooks"] } }
        },
        {
          "name": "Create a webhook endpoint",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"url\": \"https://your-crm.com/hooks/lawhired\",\n  \"events\": [\"lead.created\", \"invoice.paid\"],\n  \"description\": \"HubSpot CRM sync\"\n}"
            },
            "url": { "raw": "{{base_url}}/webhooks", "host": ["{{base_url}}"], "path": ["webhooks"] },
            "description": "⚠️ The `secret` in the response is shown ONCE — copy it immediately to verify delivery signatures."
          }
        },
        {
          "name": "Send a test event",
          "request": {
            "method": "POST",
            "url": { "raw": "{{base_url}}/webhooks/1/test", "host": ["{{base_url}}"], "path": ["webhooks", "1", "test"] }
          }
        },
        {
          "name": "Delete a webhook endpoint",
          "request": {
            "method": "DELETE",
            "url": { "raw": "{{base_url}}/webhooks/1", "host": ["{{base_url}}"], "path": ["webhooks", "1"] }
          }
        }
      ]
    }
  ]
}
