Create a form
A hosted form endpoint: point an HTML <form action> (or coss/forms) at its endpoint. Every submission is screened by Risk (the honeypot, captcha, email, IP, device, velocity and content) and accepted ones go to webhooks (form.submission.received), notification emails and contacts. Without fields, any field is accepted.
bearerAuthAuthorizationBearer <token>A secret API key from the dashboard: coss_live_… for production environments, coss_test_… for sandbox environments.
Coss-Version?"2026-10-10"The API version (a date) to use for this request. Defaults to your organization's version, pinned to the latest one when it first used the API and upgraded from the dashboard. The SDK always sends the version it was built for.
"2026-10-10"application/json- body
- body
- …
name*string1 <= length <= 100enabled?booleanfalse: submissions are refused.
fields?array<>|The form's fields. null (default): any field is accepted. With fields, submissions are validated against them.
items <= 50strict_fields?booleanWith fields: refuse fields the form doesn't define. Default false.
allowed_origins?array<>Sites that may post to the form, like https://www.example.com (sandbox environments also http://localhost:<port>). Empty (default): any.
items <= 10redirect_url?|Where browsers go after an HTML post. null: coss.com's thank-you page. A post's _next field overrides it when its origin is allowed.
urilength <= 2048spam?submitter?notifications?contacts?files?hosted?The form.
application/json- response
- response
- …
object*"form""form"id*stringname*stringenabled*booleanendpoint*stringWhere the form posts: <form action=…>.
hosted_url*|The hosted page, when hosted.enabled; null otherwise.
fields*array<>|nullstrict_fields*booleanallowed_origins*array<string>redirect_url*string|nullspam*submitter*notifications*contacts*files*hosted*disabled_by_admin*booleancoss.com disabled the form for abuse; contact support.
sandbox*booleancreated_at*stringdate-timeupdated_at*stringdate-timeimport { Coss } from "coss";const coss = new Coss({ apiKey: process.env.COSS_API_KEY, baseUrl: "https://api.coss.com",});const { data, error } = await coss.forms.create({ name: "Contact us", allowed_origins: [ "https://www.example.com", ], notifications: { recipients: [ "support@example.com", ], },});{ "object": "form", "id": "form_01kd2m8n3p4q5r6s7t8v9w0x1y", "name": "Contact us", "enabled": true, "endpoint": "https://cossforms.com/f/form_01kd2m8n3p4q5r6s7t8v9w0x1y", "hosted_url": null, "fields": null, "strict_fields": false, "allowed_origins": [ "https://www.example.com" ], "redirect_url": null, "spam": { "honeypot_field": "_gotcha", "captcha": "off", "captcha_site_key": null, "content_threshold": 0.9, "on_review": "hold" }, "submitter": { "email_field": "email", "verify": false, "confirmation_from": null }, "notifications": { "recipients": [ "support@example.com" ], "from": null }, "contacts": { "enabled": false, "audience_ids": [], "topics": [], "double_opt_in": null, "first_name_field": null, "last_name_field": null, "properties": {} }, "files": { "enabled": false, "max_files": 3, "max_file_bytes": 10485760, "allowed_types": [] }, "hosted": { "enabled": false, "title": null, "description": null, "submit_label": null, "success_message": null, "published_at": null }, "disabled_by_admin": false, "sandbox": false, "created_at": "2026-10-29T10:00:00.000Z", "updated_at": "2026-10-29T10:00:00.000Z"}