{
  "info": {
    "_postman_id": "mati-api-v1-1785474132883",
    "name": "Mati API v1",
    "description": "Booking, scheduling and payments API for developers building with Mati.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "apikey",
    "apikey": [
      {
        "key": "key",
        "value": "x-mati-api-key",
        "type": "string"
      },
      {
        "key": "value",
        "value": "{{apiKey}}",
        "type": "string"
      },
      {
        "key": "in",
        "value": "header",
        "type": "string"
      }
    ]
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "// Auto-set baseUrl and apiKey from collection variables"
        ]
      }
    }
  ],
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://app.mati-ia.com/api/v1"
    },
    {
      "key": "apiKey",
      "value": "mat_sk_YOUR_API_KEY"
    },
    {
      "key": "slug",
      "value": "mi-agenda-mati"
    },
    {
      "key": "webhookId",
      "value": "your_webhookId"
    }
  ],
  "item": [
    {
      "name": "Workspaces",
      "item": [
        {
          "name": "Get workspace",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "description": "Returns public workspace metadata. Requires an API key for developer backends.",
            "url": {
              "raw": "{{baseUrl}}/workspaces/{{slug}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "workspaces",
                "{{slug}}"
              ]
            }
          },
          "response": [],
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// Ensure {{slug}} is set in collection variables"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "Services",
      "item": [
        {
          "name": "List services",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "description": "Returns active services for a workspace.",
            "url": {
              "raw": "{{baseUrl}}/workspaces/{{slug}}/services",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "workspaces",
                "{{slug}}",
                "services"
              ]
            }
          },
          "response": [],
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// Ensure {{slug}} is set in collection variables"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "Availability",
      "item": [
        {
          "name": "Get available slots",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "description": "Returns free time slots for a service and provider on a specific date. Used by the booking widget to render the calendar.",
            "url": {
              "raw": "{{baseUrl}}/workspaces/{{slug}}/availability",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "workspaces",
                "{{slug}}",
                "availability"
              ]
            }
          },
          "response": [],
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// Ensure {{slug}} is set in collection variables"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "Widget",
      "item": [
        {
          "name": "Get widget config",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "description": "Public endpoint used by the widget to load workspace settings and custom fields.",
            "url": {
              "raw": "{{baseUrl}}/workspaces/{{slug}}/config",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "workspaces",
                "{{slug}}",
                "config"
              ]
            }
          },
          "response": [],
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// Ensure {{slug}} is set in collection variables"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "Bookings",
      "item": [
        {
          "name": "List bookings",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "description": "Returns recent bookings for the workspace. Paginated (max 100 per page).",
            "url": {
              "raw": "{{baseUrl}}/workspaces/{{slug}}/bookings",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "workspaces",
                "{{slug}}",
                "bookings"
              ]
            }
          },
          "response": [],
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// Ensure {{slug}} is set in collection variables"
                ]
              }
            }
          ]
        },
        {
          "name": "Create booking",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "description": "Creates a new booking. Can be called either with an API key (backend-to-backend) or from an authorized widget domain (public).",
            "url": {
              "raw": "{{baseUrl}}/workspaces/{{slug}}/bookings",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "workspaces",
                "{{slug}}",
                "bookings"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"serviceId\": \"string\",\n  \"providerId\": \"string\",\n  \"email\": \"string\",\n  \"name\": \"string\",\n  \"phone\": \"string\",\n  \"date\": \"2026-08-15T10:00:00Z\",\n  \"duration\": 0,\n  \"notes\": \"string\",\n  \"recaptchaToken\": \"string\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": [],
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// Ensure {{slug}} is set in collection variables"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "Webhooks",
      "item": [
        {
          "name": "List webhooks",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "description": "Returns all webhooks configured for the workspace.",
            "url": {
              "raw": "{{baseUrl}}/workspaces/{{slug}}/webhooks",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "workspaces",
                "{{slug}}",
                "webhooks"
              ]
            }
          },
          "response": [],
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// Ensure {{slug}} is set in collection variables"
                ]
              }
            }
          ]
        },
        {
          "name": "Create webhook",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "description": "Registers a new webhook endpoint. Returns the secret used to verify signatures — store it securely, it is only shown once.",
            "url": {
              "raw": "{{baseUrl}}/workspaces/{{slug}}/webhooks",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "workspaces",
                "{{slug}}",
                "webhooks"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"string\",\n  \"url\": \"string\",\n  \"events\": [\n    \"booking.created\",\n    \"payment.received\"\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": [],
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// Ensure {{slug}} is set in collection variables"
                ]
              }
            }
          ]
        },
        {
          "name": "Get webhook",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "description": "Get webhook",
            "url": {
              "raw": "{{baseUrl}}/workspaces/{{slug}}/webhooks/{{webhookId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "workspaces",
                "{{slug}}",
                "webhooks",
                "{{webhookId}}"
              ]
            }
          },
          "response": [],
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// Ensure {{slug}} is set in collection variables",
                  "// Ensure {{webhookId}} is set in collection variables"
                ]
              }
            }
          ]
        },
        {
          "name": "Update webhook",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "description": "Update name, URL, events filter, or active flag. Cannot change the secret — delete and recreate if compromised.",
            "url": {
              "raw": "{{baseUrl}}/workspaces/{{slug}}/webhooks/{{webhookId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "workspaces",
                "{{slug}}",
                "webhooks",
                "{{webhookId}}"
              ]
            }
          },
          "response": [],
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// Ensure {{slug}} is set in collection variables",
                  "// Ensure {{webhookId}} is set in collection variables"
                ]
              }
            }
          ]
        },
        {
          "name": "Delete webhook",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "description": "Delete webhook",
            "url": {
              "raw": "{{baseUrl}}/workspaces/{{slug}}/webhooks/{{webhookId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "workspaces",
                "{{slug}}",
                "webhooks",
                "{{webhookId}}"
              ]
            }
          },
          "response": [],
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// Ensure {{slug}} is set in collection variables",
                  "// Ensure {{webhookId}} is set in collection variables"
                ]
              }
            }
          ]
        }
      ]
    }
  ]
}