{
  "openapi": "3.1.0",
  "info": {
    "title": "Inletbase Form Submission API",
    "version": "1.0.0",
    "summary": "Submit website form data to Inletbase with one POST request.",
    "description": "Every form created in Inletbase gets a CORS-enabled submission endpoint. A request is authenticated with an organization API key, checked for spam, validated against the form's fields, stored, and then fanned out to email notifications, AI auto-replies, workflows and CRM sync.\n\nThis document covers the public submission endpoint only. Dashboard and management APIs are not public.",
    "contact": {
      "name": "Inletbase support",
      "email": "hello@inletbase.com",
      "url": "https://inletbase.com/contact"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://inletbase.com/legal/terms"
    }
  },
  "externalDocs": {
    "description": "API reference",
    "url": "https://inletbase.com/docs/user-guides/api-reference"
  },
  "servers": [
    {
      "url": "https://inletbase.com",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Submissions",
      "description": "Sending form data to Inletbase."
    }
  ],
  "paths": {
    "/api/v1/forms/{slug}/submit": {
      "post": {
        "tags": [
          "Submissions"
        ],
        "operationId": "submitForm",
        "summary": "Submit a form",
        "description": "Sends one submission to the form identified by `slug`.\n\nKeys in the body should match the field keys defined for the form in the dashboard. Extra keys that the form does not define are still accepted and stored as metadata.\n\nAuthentication accepts three transports, checked in this order: the `Authorization: Bearer` header, the `x-api-key` header, then the `apikey` query parameter. The query parameter exists for builders such as Webflow and Framer that cannot send custom headers.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          },
          {
            "apiKeyQuery": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "The form's slug, as shown in the dashboard.",
            "schema": {
              "type": "string"
            },
            "example": "contact"
          },
          {
            "name": "redirect",
            "in": "query",
            "required": false,
            "description": "Absolute or relative URL to redirect to after a successful submission. Honoured only when it resolves to the same origin as Inletbase or to the submitting site's own origin; any other target is ignored and JSON is returned instead.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Field keys and values. JSON is recommended.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmissionBody"
              },
              "examples": {
                "contact": {
                  "summary": "A contact form",
                  "value": {
                    "email": "jane@example.com",
                    "full_name": "Jane Doe",
                    "message": "Hello from the API"
                  }
                },
                "withRedirect": {
                  "summary": "With a post-submit redirect",
                  "value": {
                    "email": "jane@example.com",
                    "message": "Hello",
                    "_redirect": "/thanks"
                  }
                }
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/SubmissionBody"
              }
            },
            "multipart/form-data": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/SubmissionBody"
                  },
                  {
                    "type": "object",
                    "description": "File parts are accepted. Per-file size limits come from the organization's plan."
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Submission accepted and stored.\n\nAlso returned when the honeypot field (`_gotcha` or `honeypot`) is filled in: the response is a decoy success and the submission is dropped without notifying anyone.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubmissionSuccess"
                },
                "example": {
                  "success": true,
                  "submissionId": "abc123",
                  "message": "Form submitted successfully",
                  "status": 200
                }
              }
            }
          },
          "303": {
            "description": "Redirect issued because a `_redirect` target resolved to an allowed origin. No body."
          },
          "400": {
            "description": "Validation failed, or the body could not be parsed.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationError"
                    },
                    {
                      "$ref": "#/components/schemas/SimpleError"
                    }
                  ]
                },
                "examples": {
                  "validation": {
                    "summary": "A field failed validation",
                    "value": {
                      "success": false,
                      "message": "Validation failed",
                      "details": {
                        "email": "Invalid email address format."
                      },
                      "status": 400
                    }
                  },
                  "unparseable": {
                    "summary": "Body or content type could not be read",
                    "value": {
                      "error": "Invalid request body or content type"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "No API key was supplied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                },
                "example": {
                  "error": "API Key is required for this request"
                }
              }
            }
          },
          "403": {
            "description": "The request was understood but refused: the key is invalid, the key belongs to another organization, the browser's origin is not in the form's allowed domains, the form requires a browser origin and none was sent, the monthly submission limit is reached, no email account is connected, or file uploads are not permitted.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/SimpleError"
                    },
                    {
                      "$ref": "#/components/schemas/ValidationError"
                    }
                  ]
                },
                "examples": {
                  "invalidKey": {
                    "summary": "Key not recognised or revoked",
                    "value": {
                      "error": "Invalid API Key"
                    }
                  },
                  "domain": {
                    "summary": "Origin not in the form's allowed domains",
                    "value": {
                      "error": "Domain 'example.com' is not whitelisted by this form."
                    }
                  },
                  "browserOnly": {
                    "summary": "Form accepts browser submissions only",
                    "value": {
                      "error": "This form only accepts submissions from a browser on an allowed domain."
                    }
                  },
                  "quota": {
                    "summary": "Plan limit reached",
                    "value": {
                      "success": false,
                      "message": "Monthly submission limit reached.",
                      "status": 403
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No form with that slug belongs to the organization the key resolves to.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                },
                "example": {
                  "error": "Form not found"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than 5MB. Files travel base64-encoded inside JSON, which inflates them by roughly a third, so the transport cap is higher than the per-file plan limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                },
                "example": {
                  "error": "File is too large. Maximum allowed size is 5MB."
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Two independent limits apply: 30 requests per minute per IP address, and 120 requests per minute per API key.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                },
                "examples": {
                  "perIp": {
                    "summary": "Per-IP limit",
                    "value": {
                      "error": "Too many requests. Please try again later."
                    }
                  },
                  "perKey": {
                    "summary": "Per-key limit",
                    "value": {
                      "error": "API key rate limit exceeded. Please try again later."
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure on our side. The submission was not stored; the request is safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/SimpleError"
                    },
                    {
                      "$ref": "#/components/schemas/ValidationError"
                    }
                  ]
                },
                "example": {
                  "error": "An internal server error occurred."
                }
              }
            }
          }
        }
      },
      "options": {
        "tags": [
          "Submissions"
        ],
        "operationId": "submitFormPreflight",
        "summary": "CORS preflight",
        "description": "Returns the CORS headers for the submit endpoint. Browsers call this automatically.",
        "security": [],
        "responses": {
          "204": {
            "description": "No content.",
            "headers": {
              "Access-Control-Allow-Origin": {
                "description": "Always `*`. The endpoint is protected by API key authentication and, for browser traffic, the form's allowed-domains list.",
                "schema": {
                  "type": "string"
                }
              },
              "Access-Control-Allow-Methods": {
                "description": "`POST, OPTIONS`",
                "schema": {
                  "type": "string"
                }
              },
              "Access-Control-Allow-Headers": {
                "description": "`Content-Type, Authorization, x-api-key`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Organization API key in the Authorization header: `Authorization: Bearer ib_live_...`. Recommended for server-side callers."
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Organization API key in the `x-api-key` header."
      },
      "apiKeyQuery": {
        "type": "apiKey",
        "in": "query",
        "name": "apikey",
        "description": "Organization API key as a query value, for platforms that cannot send custom headers, such as Webflow and Framer. Prefer the Authorization header where you have the choice: query values are recorded in browser history, proxies and server logs."
      }
    },
    "headers": {
      "RetryAfter": {
        "description": "Seconds to wait before retrying.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "XRateLimitLimit": {
        "description": "Requests allowed in the current window.",
        "schema": {
          "type": "integer"
        }
      },
      "XRateLimitRemaining": {
        "description": "Requests left in the current window.",
        "schema": {
          "type": "integer"
        }
      }
    },
    "schemas": {
      "SubmissionBody": {
        "type": "object",
        "description": "Field keys and values for the form. Keys should match the form's configured field keys; unknown keys are accepted and stored as metadata.",
        "additionalProperties": true,
        "properties": {
          "_redirect": {
            "type": "string",
            "description": "URL to redirect to after success. Honoured only for the same origin as Inletbase or the submitting site's own origin."
          },
          "_meta": {
            "type": "object",
            "description": "Free-form context about the submission. `source_url` and `current_url` are read to label where the submission came from.",
            "additionalProperties": true
          },
          "_gotcha": {
            "type": "string",
            "description": "Honeypot. Leave empty. If filled, the API returns 200 and silently drops the submission."
          }
        }
      },
      "SubmissionSuccess": {
        "type": "object",
        "required": [
          "success",
          "message",
          "status"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "const": true
          },
          "submissionId": {
            "type": "string",
            "description": "Identifier for the stored submission. Absent when the honeypot drops a submission."
          },
          "message": {
            "type": "string",
            "examples": [
              "Form submitted successfully"
            ]
          },
          "status": {
            "type": "integer",
            "examples": [
              200
            ]
          }
        }
      },
      "ValidationError": {
        "type": "object",
        "description": "Error body used by validation and quota failures.",
        "required": [
          "success",
          "message",
          "status"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "const": false
          },
          "message": {
            "type": "string",
            "examples": [
              "Validation failed"
            ]
          },
          "details": {
            "type": "object",
            "description": "One entry per field that needs fixing, keyed by field key.",
            "additionalProperties": {
              "type": "string"
            }
          },
          "status": {
            "type": "integer",
            "examples": [
              400
            ]
          }
        }
      },
      "SimpleError": {
        "type": "object",
        "description": "Error body used by authentication, rate limit, payload size and lookup failures.",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "examples": [
              "Invalid API Key"
            ]
          }
        }
      }
    }
  }
}