{
  "info": {
    "name": "Contar Prazos PT Public API",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "description": "API keys remain bound to their issuing team. Portal operations use Better Auth sessions (__Secure-better-auth.session_token over HTTPS; better-auth.session_token on local HTTP). Each saved browser account retains its own workspace. Sign in again after migration. SDK and public calculation contracts are unchanged.\nSaved cases expose an optional archived boolean. Archived deadlines are omitted from calendar feeds; list/sync responses retain them."
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://contarprazos.pt"
    },
    {
      "key": "apiKey",
      "value": "pzs_live_xxx.secret"
    },
    {
      "key": "processId",
      "value": "proc_example"
    },
    {
      "key": "rulesVersion",
      "value": "2.2.1"
    },
    {
      "key": "organizationId",
      "value": "org_example"
    },
    {
      "key": "joinToken",
      "value": ""
    },
    {
      "key": "newTeamName",
      "value": "Nova equipa"
    }
  ],
  "item": [
    {
      "name": "Browser session - team workspaces",
      "description": "Requires an authenticated Better Auth session in the Postman cookie jar. API keys do not authorize these operations. Use __personal__ to select legacy personal data.",
      "item": [
        {
          "name": "Create team",
          "request": {
            "method": "POST",
            "auth": {
              "type": "noauth"
            },
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/team/create"
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"{{newTeamName}}\"\n}"
            }
          }
        },
        {
          "name": "Switch workspace",
          "request": {
            "method": "POST",
            "auth": {
              "type": "noauth"
            },
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/account/switch-org"
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"organizationId\": \"{{organizationId}}\"\n}"
            }
          }
        },
        {
          "name": "Enable or rotate join link",
          "request": {
            "method": "PUT",
            "auth": {
              "type": "noauth"
            },
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/team/join-link"
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"organizationId\": \"{{organizationId}}\",\n  \"enabled\": true\n}"
            }
          }
        },
        {
          "name": "Disable join link",
          "request": {
            "method": "PUT",
            "auth": {
              "type": "noauth"
            },
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/team/join-link"
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"organizationId\": \"{{organizationId}}\",\n  \"enabled\": false\n}"
            }
          }
        },
        {
          "name": "Join team",
          "request": {
            "method": "POST",
            "auth": {
              "type": "noauth"
            },
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/team/join"
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"token\": \"{{joinToken}}\"\n}"
            }
          }
        }
      ]
    },
    {
      "name": "Calculate deadline",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{apiKey}}"
          },
          {
            "key": "X-Prazos-API-Version",
            "value": "2026-05-19"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/deadline-calculations"
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"startDate\": \"2026-05-04\",\n  \"amount\": 10,\n  \"unit\": \"dias\",\n  \"kind\": \"processual\"\n}"
        }
      }
    },
    {
      "name": "List deadline templates",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{apiKey}}"
          },
          {
            "key": "X-Prazos-API-Version",
            "value": "2026-05-19"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/deadline-templates"
        }
      }
    },
    {
      "name": "Sync process",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{apiKey}}"
          },
          {
            "key": "X-Prazos-API-Version",
            "value": "2026-05-19"
          },
          {
            "key": "Idempotency-Key",
            "value": "process-kleos-123-v1"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/processes/sync"
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"externalId\": \"kleos-123\",\n  \"name\": \"Processo principal\",\n  \"tags\": [\"civil\"]\n}"
        }
      }
    },
    {
      "name": "Sync case",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{apiKey}}"
          },
          {
            "key": "X-Prazos-API-Version",
            "value": "2026-05-19"
          },
          {
            "key": "Idempotency-Key",
            "value": "case-deadline-123-v1"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/cases/sync"
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"externalId\": \"deadline-123\",\n  \"processExternalId\": \"kleos-123\",\n  \"label\": \"Contestacao\",\n  \"calculation\": {\n    \"startDate\": \"2026-05-04\",\n    \"amount\": 10,\n    \"unit\": \"dias\",\n    \"kind\": \"processual\"\n  }\n}"
        }
      }
    },
    {
      "name": "List process audit",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{apiKey}}"
          },
          {
            "key": "X-Prazos-API-Version",
            "value": "2026-05-19"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/processes/:id/audit"
        }
      }
    }
  ]
}
