{
    "openapi": "3.1.0",
    "info": {
        "title": "FlowLeads form API",
        "version": "v1",
        "description": "Public API of the FlowLeads web forms: load the form definition and submit enquiries as leads, without an API key."
    },
    "servers": [
        {
            "url": "https://api.flowsuite.one",
            "description": "FlowSuite API"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "tags": [
        {
            "name": "forms",
            "description": "Forms"
        }
    ],
    "paths": {
        "/public/flowleads/forms/{key}": {
            "get": {
                "operationId": "flowleads-forms-show",
                "summary": "Get the form definition",
                "description": "Returns the form's fields (key, label, type text, email, tel, textarea, select or checkbox, whether required, options, maximum length), a fresh signed timestamp, the names of the hidden field and of the timestamp, the submit address and the display mode: inline or iframe (with Turnstile). An unknown or deactivated key answers with HTTP 404.",
                "tags": [
                    "forms"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "ok": true,
                                    "form": {
                                        "key": "FORM_KEY",
                                        "mode": "inline",
                                        "fields": [
                                            {
                                                "key": "name",
                                                "label": "Name",
                                                "type": "text",
                                                "required": true,
                                                "options": [],
                                                "max_length": 500
                                            },
                                            {
                                                "key": "email",
                                                "label": "E-Mail",
                                                "type": "email",
                                                "required": true,
                                                "options": [],
                                                "max_length": 255
                                            },
                                            {
                                                "key": "message",
                                                "label": "Nachricht",
                                                "type": "textarea",
                                                "required": false,
                                                "options": [],
                                                "max_length": 5000
                                            }
                                        ],
                                        "token": "TIMESTAMP.SIGNATURE",
                                        "honeypot": "homepage",
                                        "token_field": "fl_ts",
                                        "submit_url": "https://api.flowsuite.one/public/flowleads/forms/k3x9q2m7v1c8n4b6z0p5r2t7w9y1a3d5",
                                        "page_url": "https://flowsuite.one/f/k3x9q2m7v1c8n4b6z0p5r2t7w9y1a3d5",
                                        "iframe_url": "https://flowsuite.one/f/k3x9q2m7v1c8n4b6z0p5r2t7w9y1a3d5?embed=1",
                                        "labels": {
                                            "submit": "Absenden",
                                            "sending": "Wird gesendet …",
                                            "required": "Mit * markierte Felder sind Pflichtfelder.",
                                            "choose": "Bitte wählen",
                                            "error": "Die Anfrage konnte gerade nicht gesendet werden. Bitte versuchen Sie es später erneut."
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "security": []
            },
            "post": {
                "operationId": "flowleads-forms-submit",
                "summary": "Submit an enquiry",
                "description": "Submits an entry as JSON or as form data. On success a lead is created in the configured pipeline (source, tags and assignment from the form) and the response is {\"ok\": true, \"message\": ...}, plus redirect_url if a redirect is set. Errors answer with ok false: 403 for a website that is not allowed, 404 for an unknown or deactivated form, 413 above 32 KB, 422 for invalid fields (errors by field key), an expired or too recent timestamp or a failed Turnstile check, 429 when the rate limit is exceeded. If the form's AI spam check is on, the AI reads the submission and afterwards moves clear spam to the spam view.",
                "tags": [
                    "forms"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "ok": true,
                                    "message": "Vielen Dank! Ihre Anfrage ist bei uns eingegangen."
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "fields": {
                                        "type": "object",
                                        "description": "The values by field key, e.g. {\"name\": \"Erika Mustermann\", \"email\": \"erika@beispiel.de\"}. Checkboxes send \"1\" or \"0\". Unknown keys are dropped."
                                    },
                                    "fl_ts": {
                                        "type": "string",
                                        "description": "The signed timestamp token from the form definition, at least 3 seconds and at most 24 hours old."
                                    },
                                    "homepage": {
                                        "type": "string",
                                        "description": "Hidden field against bots. Must stay empty or be left out."
                                    },
                                    "cf-turnstile-response": {
                                        "type": "string",
                                        "description": "Turnstile token, only for forms with Cloudflare Turnstile (hosted page or iframe)."
                                    }
                                },
                                "required": [
                                    "fields",
                                    "fl_ts"
                                ]
                            }
                        }
                    }
                },
                "security": []
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "description": "API key (pk_… or at_…) as Authorization: Bearer <key>. Any other way of sending it is rejected with 401."
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "success": {
                        "type": "boolean"
                    },
                    "error": {
                        "type": "string"
                    },
                    "message": {
                        "type": "string"
                    },
                    "errors": {
                        "type": "object"
                    }
                }
            }
        }
    }
}