# Forms

Dynamic form generation and submission

## Get form schema

> Returns the form schema and configuration for generating a form UI.

```json
{"openapi":"3.1.0","info":{"title":"CMS API - Content Management & Pages","version":"1.0.0"},"tags":[{"name":"Forms","description":"Dynamic form generation and submission"}],"servers":[{"description":"Default commerce site","url":"https://{commerce_url}","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce storefront hostname"}}}],"paths":{"/forms/{form_id}/generate":{"get":{"tags":["Forms"],"operationId":"getForm","summary":"Get form schema","description":"Returns the form schema and configuration for generating a form UI.","parameters":[{"name":"form_id","in":"path","required":true,"schema":{"type":"integer"},"description":"Form identifier"}],"responses":{"200":{"description":"Form schema retrieved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Form"}}}},"404":{"description":"Form not found or not active"}}}}},"components":{"schemas":{"Form":{"type":"object","description":"Dynamic form with JSON schema defining field definitions, validation rules, and actions.\nUsed for generating form UIs and processing form submissions. Supports multi-language\ntranslations and pretty URLs. The schema defines input types, labels, and required fields.","required":["pk","schema","is_active"],"properties":{"pk":{"type":"integer"},"name":{"type":"string"},"url":{"type":"string"},"schema":{"type":"object","description":"Form field definitions","additionalProperties":true},"template":{"type":"string"},"is_active":{"type":"boolean"},"pretty_url":{"type":"object","description":"Primary pretty URL object for the form","properties":{"url":{"type":"string","description":"Pretty URL path"}}},"formprettyurl_set":{"type":"array","description":"Multi-language pretty URL mappings for the form","items":{"type":"object","description":"Pretty URL mapping for a specific language","properties":{"pk":{"type":"integer","description":"Pretty URL identifier"},"url":{"type":"string","description":"URL path for this language"},"language":{"type":"string","description":"Language code (e.g., 'en', 'tr')"}}}},"translations":{"type":"object","description":"Translated form fields and labels by language code","additionalProperties":true},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"}}}}}}
```

## Submit form data

> Submits form data for processing. The request body structure depends on the form schema.\
> Returns validation errors if the data does not match the form schema.

```json
{"openapi":"3.1.0","info":{"title":"CMS API - Content Management & Pages","version":"1.0.0"},"tags":[{"name":"Forms","description":"Dynamic form generation and submission"}],"servers":[{"description":"Default commerce site","url":"https://{commerce_url}","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce storefront hostname"}}}],"paths":{"/forms/{form_id}/generate":{"post":{"tags":["Forms"],"operationId":"submitForm","summary":"Submit form data","description":"Submits form data for processing. The request body structure depends on the form schema.\nReturns validation errors if the data does not match the form schema.","parameters":[{"name":"form_id","in":"path","required":true,"schema":{"type":"integer"},"description":"Form identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Form data structure depends on the form schema","additionalProperties":true}}}},"responses":{"200":{"description":"Form submitted successfully","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormValidationError"}}}},"404":{"description":"Form not found or not active"}}}}},"components":{"schemas":{"FormValidationError":{"type":"object","description":"Error response returned when form submission validation fails. Contains field-level validation errors\nand the form schema for reference. Errors are organized by field name with arrays of error messages.","required":["errors","form_schema"],"properties":{"errors":{"type":"object","description":"Field-level validation errors","additionalProperties":{"type":"array","items":{"type":"string"}}},"form_schema":{"type":"object","description":"The form schema for reference","additionalProperties":true}}}}}}
```
