{
  "info": {
    "name": "SLA API",
    "description": "Employee Portal – SLA module: list, create, update, form options (including projects eligible for new SLA), export, tickets, clients.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{auth_token}}",
        "type": "string"
      }
    ]
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://roms.roqay.dev/api/v1/web",
      "type": "string"
    },
    {
      "key": "auth_token",
      "value": "",
      "type": "string"
    },
    {
      "key": "sla_id",
      "value": "1",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "Form Options (Create New SLA)",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{base_url}}/slas/form-options",
          "host": ["{{base_url}}"],
          "path": ["slas", "form-options"]
        },
        "description": "Returns contract_types, support_types, sla_types, active_priority_template, and projects (only projects eligible for new SLA: no SLA or inactive SLA only). Use projects for the Project dropdown in Create New SLA form."
      }
    },
    {
      "name": "List Filter Options (SLA page filters)",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{base_url}}/slas/list-filter-options?company_id=",
          "host": ["{{base_url}}"],
          "path": ["slas", "list-filter-options"],
          "query": [
            {
              "key": "company_id",
              "value": "",
              "description": "Optional. When set, projects returned are only those belonging to this company. Use when user selects a Company in the SLA filters so the Project dropdown shows only that company's projects."
            }
          ]
        },
        "description": "Returns companies and projects for the SLA list page filter dropdowns. Pass company_id when the user selects a Company so the Project dropdown updates to show only that company's projects."
      }
    },
    {
      "name": "List SLAs",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{base_url}}/slas",
          "host": ["{{base_url}}"],
          "path": ["slas"],
          "query": [
            {
              "key": "page",
              "value": "1",
              "description": "Page number"
            },
            {
              "key": "limit",
              "value": "15",
              "description": "Items per page"
            },
            {
              "key": "projectId",
              "value": "",
              "description": "Filter by project ID"
            },
            {
              "key": "keyword",
              "value": "",
              "description": "Search keyword"
            },
            {
              "key": "status",
              "value": "",
              "description": "Filter by status"
            },
            {
              "key": "dateFrom",
              "value": "",
              "description": "Date from"
            },
            {
              "key": "dateTo",
              "value": "",
              "description": "Date to"
            }
          ]
        }
      }
    },
    {
      "name": "Show SLA",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{base_url}}/slas/{{sla_id}}",
          "host": ["{{base_url}}"],
          "path": ["slas", "{{sla_id}}"]
        }
      }
    },
    {
      "name": "Create SLA",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Accept",
            "value": "application/json",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"project_id\": 1,\n  \"date_from\": \"2026-01-01\",\n  \"date_to\": \"2026-12-31\",\n  \"contract_type\": \"fixed_hours\",\n  \"duration_hours\": 100,\n  \"support_type\": \"24_7\",\n  \"sla_type\": \"system_default\",\n  \"service\": [1],\n  \"details\": \"SLA details text\",\n  \"coverage\": \"Coverage text\"\n}"
        },
        "url": {
          "raw": "{{base_url}}/slas",
          "host": ["{{base_url}}"],
          "path": ["slas"]
        },
        "description": "contract_type: open_hours | fixed_hours. support_type: business_hours | 24_7. sla_type: system_default | custom. service: array of 1,2,3,4 (Support, Host, Domain, Host Management). For custom sla_type include priority_configuration (see SLA Priority Templates collection)."
      }
    },
    {
      "name": "Create SLA (Custom type)",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Accept",
            "value": "application/json",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"project_id\": 1,\n  \"date_from\": \"2026-01-01\",\n  \"date_to\": \"2026-12-31\",\n  \"contract_type\": \"open_hours\",\n  \"support_type\": \"business_hours\",\n  \"sla_type\": \"custom\",\n  \"service\": [1, 2],\n  \"details\": \"Details\",\n  \"coverage\": \"Coverage\",\n  \"priority_configuration\": {\n    \"critical\": {\n      \"response_time\": \"24h\",\n      \"resolution_time\": \"48h\",\n      \"auto_close_after_resolved\": \"7d\",\n      \"in_review_time\": \"24h\"\n    },\n    \"high\": {\n      \"response_time\": \"12h\",\n      \"resolution_time\": \"24h\",\n      \"auto_close_after_resolved\": \"7d\",\n      \"in_review_time\": \"12h\"\n    },\n    \"medium\": {\n      \"response_time\": \"8h\",\n      \"resolution_time\": \"16h\",\n      \"auto_close_after_resolved\": \"5d\",\n      \"in_review_time\": \"8h\"\n    },\n    \"low\": {\n      \"response_time\": \"4h\",\n      \"resolution_time\": \"8h\",\n      \"auto_close_after_resolved\": \"3d\",\n      \"in_review_time\": \"4h\"\n    }\n  }\n}"
        },
        "url": {
          "raw": "{{base_url}}/slas",
          "host": ["{{base_url}}"],
          "path": ["slas"]
        },
        "description": "When sla_type is custom, priority_configuration is required. Time format: number + m|h|d (e.g. 24h, 30m, 2d). For open_hours omit duration_hours."
      }
    },
    {
      "name": "Update SLA",
      "request": {
        "method": "PUT",
        "header": [
          {
            "key": "Accept",
            "value": "application/json",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"details\": \"Updated details\",\n  \"coverage\": \"Updated coverage\",\n  \"service\": [1, 2, 3]\n}"
        },
        "url": {
          "raw": "{{base_url}}/slas/{{sla_id}}",
          "host": ["{{base_url}}"],
          "path": ["slas", "{{sla_id}}"]
        }
      }
    },
    {
      "name": "Delete SLA",
      "request": {
        "method": "DELETE",
        "header": [
          {
            "key": "Accept",
            "value": "application/json",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{base_url}}/slas/{{sla_id}}",
          "host": ["{{base_url}}"],
          "path": ["slas", "{{sla_id}}"]
        }
      }
    },
    {
      "name": "Export SLAs (Excel)",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Accept",
            "value": "application/json",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"projectId\": null,\n  \"keyword\": null,\n  \"status\": null,\n  \"dateFrom\": null,\n  \"dateTo\": null\n}"
        },
        "url": {
          "raw": "{{base_url}}/slas/export-excel",
          "host": ["{{base_url}}"],
          "path": ["slas", "export-excel"]
        },
        "description": "Returns file URL and file_name. Download the file using the export-download endpoint with the path from the response."
      }
    },
    {
      "name": "Download SLA Export",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{base_url}}/slas/export-download?path=public/slas/2026-02-25_1234567890abc.xlsx",
          "host": ["{{base_url}}"],
          "path": ["slas", "export-download"],
          "query": [
            {
              "key": "path",
              "value": "public/slas/2026-02-25_1234567890abc.xlsx",
              "description": "Path returned from export-excel response (file or full path)"
            }
          ]
        },
        "description": "Use the path value from the export-excel response. Requires auth."
      }
    },
    {
      "name": "SLA Tickets",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{base_url}}/slas/{{sla_id}}/tickets",
          "host": ["{{base_url}}"],
          "path": ["slas", "{{sla_id}}", "tickets"],
          "query": [
            {
              "key": "keyword",
              "value": "",
              "description": "Filter by title or ticket_number"
            },
            {
              "key": "customer_id",
              "value": "",
              "description": "Filter by client (customer) ID"
            },
            {
              "key": "limit",
              "value": "15"
            },
            {
              "key": "page",
              "value": "1"
            }
          ]
        }
      }
    },
    {
      "name": "SLA Clients",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{base_url}}/slas/{{sla_id}}/clients",
          "host": ["{{base_url}}"],
          "path": ["slas", "{{sla_id}}", "clients"]
        },
        "description": "Returns customers (clients) assigned to the SLA's project for dropdown filters."
      }
    }
  ]
}
