{
  "info": {
    "name": "Static.app API",
    "description": "Static.app public REST API. Set the `apiKey` collection variable to your `sk_...` key (Account → API). Set `pid` to a site's public ID. All requests inherit Bearer auth from the collection.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_postman_id": "static-app-api-v1"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      { "key": "token", "value": "{{apiKey}}", "type": "string" }
    ]
  },
  "variable": [
    { "key": "baseUrl", "value": "https://api.static.app/v1", "type": "string" },
    { "key": "appUrl", "value": "https://static.app", "type": "string" },
    { "key": "apiKey", "value": "sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "type": "string" },
    { "key": "pid", "value": "xxxxxxxxxx", "type": "string" },
    { "key": "formId", "value": "1", "type": "string" },
    { "key": "teamPid", "value": "", "type": "string" }
  ],
  "item": [
    {
      "name": "Users",
      "item": [
        {
          "name": "Get profile",
          "request": {
            "method": "GET",
            "header": [],
            "url": { "raw": "{{baseUrl}}/users/profile", "host": ["{{baseUrl}}"], "path": ["users", "profile"] }
          }
        }
      ]
    },
    {
      "name": "Workspaces",
      "item": [
        {
          "name": "List workspaces",
          "request": {
            "method": "GET",
            "header": [],
            "url": { "raw": "{{baseUrl}}/workspaces", "host": ["{{baseUrl}}"], "path": ["workspaces"] }
          }
        },
        {
          "name": "Get current workspace",
          "request": {
            "method": "GET",
            "header": [],
            "url": { "raw": "{{baseUrl}}/workspaces/current", "host": ["{{baseUrl}}"], "path": ["workspaces", "current"] }
          }
        },
        {
          "name": "Switch workspace",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n    \"workspace_pid\": \"{{teamPid}}\"\n}" },
            "url": { "raw": "{{baseUrl}}/workspaces/switch", "host": ["{{baseUrl}}"], "path": ["workspaces", "switch"] }
          },
          "description": "Switches the active workspace globally. Pass `X-Team-Pid` header on any request to override per-request without switching."
        }
      ]
    },
    {
      "name": "Sites",
      "item": [
        {
          "name": "List sites",
          "request": {
            "method": "GET",
            "header": [],
            "url": { "raw": "{{baseUrl}}/sites", "host": ["{{baseUrl}}"], "path": ["sites"] }
          }
        },
        {
          "name": "Get site",
          "request": {
            "method": "GET",
            "header": [],
            "url": { "raw": "{{baseUrl}}/sites/{{pid}}", "host": ["{{baseUrl}}"], "path": ["sites", "{{pid}}"] }
          }
        },
        {
          "name": "Create / update from URL",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n    \"url\": \"https://example.com/site.zip\",\n    \"domain\": \"example-site\"\n}" },
            "url": { "raw": "{{baseUrl}}/sites", "host": ["{{baseUrl}}"], "path": ["sites"] }
          },
          "description": "Imports a site from a remote ZIP. Add `pid` to update an existing site."
        },
        {
          "name": "Create / update from ZIP upload",
          "request": {
            "method": "POST",
            "header": [],
            "body": {
              "mode": "formdata",
              "formdata": [
                { "key": "archive", "type": "file", "src": [] },
                { "key": "domain", "value": "example-site", "type": "text", "disabled": true },
                { "key": "pid", "value": "{{pid}}", "type": "text", "disabled": true }
              ]
            },
            "url": { "raw": "{{baseUrl}}/sites/zip", "host": ["{{baseUrl}}"], "path": ["sites", "zip"] }
          }
        },
        {
          "name": "Delete site",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": { "raw": "{{baseUrl}}/sites/{{pid}}", "host": ["{{baseUrl}}"], "path": ["sites", "{{pid}}"] }
          }
        },
        {
          "name": "Rename free domain",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n    \"domain\": \"new-subdomain\"\n}" },
            "url": { "raw": "{{baseUrl}}/sites/{{pid}}/rename-free-domain", "host": ["{{baseUrl}}"], "path": ["sites", "{{pid}}", "rename-free-domain"] }
          }
        },
        {
          "name": "Purge cache",
          "request": {
            "method": "POST",
            "header": [],
            "url": { "raw": "{{baseUrl}}/sites/{{pid}}/purge-cache", "host": ["{{baseUrl}}"], "path": ["sites", "{{pid}}", "purge-cache"] }
          }
        },
        {
          "name": "Hold sites",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n    \"pids\": [\"{{pid}}\"]\n}" },
            "url": { "raw": "{{baseUrl}}/sites/hold", "host": ["{{baseUrl}}"], "path": ["sites", "hold"] }
          }
        },
        {
          "name": "Unhold sites",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n    \"pids\": [\"{{pid}}\"]\n}" },
            "url": { "raw": "{{baseUrl}}/sites/unhold", "host": ["{{baseUrl}}"], "path": ["sites", "unhold"] }
          }
        }
      ]
    },
    {
      "name": "Files",
      "item": [
        {
          "name": "List files in a site",
          "request": {
            "method": "GET",
            "header": [],
            "url": { "raw": "{{baseUrl}}/sites/files/{{pid}}", "host": ["{{baseUrl}}"], "path": ["sites", "files", "{{pid}}"] }
          }
        },
        {
          "name": "List files across sites",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n    \"pids\": [\"{{pid}}\"]\n}" },
            "url": { "raw": "{{baseUrl}}/sites/files-by-pids", "host": ["{{baseUrl}}"], "path": ["sites", "files-by-pids"] }
          }
        },
        {
          "name": "Download site archive",
          "request": {
            "method": "GET",
            "header": [],
            "url": { "raw": "{{baseUrl}}/sites/download/{{pid}}", "host": ["{{baseUrl}}"], "path": ["sites", "download", "{{pid}}"] }
          },
          "description": "Returns a ZIP of the entire site."
        },
        {
          "name": "Download selected files",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n    \"files\": [\"index.html\", \"assets/style.css\"]\n}" },
            "url": { "raw": "{{baseUrl}}/sites/download-files/{{pid}}", "host": ["{{baseUrl}}"], "path": ["sites", "download-files", "{{pid}}"] }
          }
        },
        {
          "name": "Upload files",
          "request": {
            "method": "POST",
            "header": [],
            "body": {
              "mode": "formdata",
              "formdata": [
                { "key": "files[]", "type": "file", "src": [] },
                { "key": "path", "value": "/", "type": "text", "disabled": true }
              ]
            },
            "url": { "raw": "{{baseUrl}}/sites/upload-files/{{pid}}", "host": ["{{baseUrl}}"], "path": ["sites", "upload-files", "{{pid}}"] }
          }
        },
        {
          "name": "Delete files",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n    \"files\": [\"old.html\"]\n}" },
            "url": { "raw": "{{baseUrl}}/sites/delete-files/{{pid}}", "host": ["{{baseUrl}}"], "path": ["sites", "delete-files", "{{pid}}"] }
          }
        },
        {
          "name": "Read file",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n    \"fileName\": \"data.csv\",\n    \"relativePath\": \"public_html\"\n}" },
            "url": { "raw": "{{appUrl}}/api/files/{{pid}}/read", "host": ["{{appUrl}}"], "path": ["api", "files", "{{pid}}", "read"] }
          },
          "description": "Served from the main domain (static.app), not api.static.app."
        },
        {
          "name": "Append / prepend to file",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n    \"fileName\": \"data.csv\",\n    \"relativePath\": \"public_html\",\n    \"content\": \"3,baz\",\n    \"position\": \"bottom\",\n    \"newline\": true\n}" },
            "url": { "raw": "{{appUrl}}/api/files/{{pid}}/edit", "host": ["{{appUrl}}"], "path": ["api", "files", "{{pid}}", "edit"] }
          },
          "description": "Served from the main domain (static.app). `position` = `top` or `bottom`."
        }
      ]
    },
    {
      "name": "Forms",
      "item": [
        {
          "name": "List forms",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n    \"sort\": \"desc\"\n}" },
            "url": { "raw": "{{baseUrl}}/sites/{{pid}}/forms", "host": ["{{baseUrl}}"], "path": ["sites", "{{pid}}", "forms"] }
          }
        },
        {
          "name": "Get form",
          "request": {
            "method": "POST",
            "header": [],
            "url": { "raw": "{{baseUrl}}/sites/{{pid}}/forms/{{formId}}", "host": ["{{baseUrl}}"], "path": ["sites", "{{pid}}", "forms", "{{formId}}"] }
          }
        },
        {
          "name": "Delete forms",
          "request": {
            "method": "DELETE",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n    \"ids\": [{{formId}}]\n}" },
            "url": { "raw": "{{baseUrl}}/sites/{{pid}}/forms", "host": ["{{baseUrl}}"], "path": ["sites", "{{pid}}", "forms"] }
          }
        },
        {
          "name": "Change notification email",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n    \"email\": \"new@example.com\"\n}" },
            "url": { "raw": "{{baseUrl}}/sites/{{pid}}/forms/change-email", "host": ["{{baseUrl}}"], "path": ["sites", "{{pid}}", "forms", "change-email"] }
          }
        },
        {
          "name": "List entries",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n    \"sort\": \"desc\",\n    \"page\": 1\n}" },
            "url": { "raw": "{{baseUrl}}/sites/{{pid}}/forms/{{formId}}/entries", "host": ["{{baseUrl}}"], "path": ["sites", "{{pid}}", "forms", "{{formId}}", "entries"] }
          }
        },
        {
          "name": "Delete entries",
          "request": {
            "method": "DELETE",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n    \"ids\": [1, 2, 3]\n}" },
            "url": { "raw": "{{baseUrl}}/sites/{{pid}}/forms/{{formId}}/entries", "host": ["{{baseUrl}}"], "path": ["sites", "{{pid}}", "forms", "{{formId}}", "entries"] }
          }
        },
        {
          "name": "Mark entries as spam",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n    \"ids\": [1, 2, 3]\n}" },
            "url": { "raw": "{{baseUrl}}/sites/{{pid}}/forms/{{formId}}/entries/mark-spam", "host": ["{{baseUrl}}"], "path": ["sites", "{{pid}}", "forms", "{{formId}}", "entries", "mark-spam"] }
          }
        }
      ]
    }
  ]
}
