{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/proxymail-qa/json-schema/proxymail-qa-signup-form-change-schema.json",
  "title": "SignupFormChange",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/proxymail-qa-openapi.json#/components/schemas/SignupFormChange",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "enum": [
        "saved",
        "removed",
        "requested"
      ],
      "description": "requested: the project is locked, so a lead was asked."
    },
    "form": {
      "$ref": "#/$defs/SignupForm"
    },
    "fields_filled_by": {
      "type": "array",
      "description": "Saving: what fills each field a custom field fills. made: the save makes a ready-made one; form: a ready-made field a form made; yours: the project’s own. A field with section custom has named: true and finds: whether its custom field finds it on the page.",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "clashes": {
      "type": "array",
      "description": "Saving: fields the project’s own custom field also fills, where the form’s ready-made field wins.",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "leftovers": {
      "type": "array",
      "description": "Saving: custom fields the form made and no longer uses (gone, renamed or yours).",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "tidied": {
      "type": "object",
      "description": "Saving with tidy: the custom fields moved, removed, asked about and kept, by name.",
      "additionalProperties": true
    },
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "The form removed."
    },
    "custom_fields_removed": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Removing: the custom fields that went with it, by name."
    },
    "custom_fields_asked": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Removing with remove_custom_fields on a locked project, for a key whose creator isn’t a lead: those the leads were asked to remove."
    },
    "custom_fields_kept": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Removing with remove_custom_fields: those that stay, as someone else made them on an unlocked project, or a request to the leads couldn’t be sent (5 waiting, or a different request about it waiting)."
    },
    "request": {
      "$ref": "#/$defs/ChangeRequest"
    }
  },
  "$defs": {
    "ChangeRequest": {
      "type": "object",
      "description": "A request to the project's leads, who approve or decline it in Project settings. Who asked and answered, and when, are in the app.",
      "required": [
        "id",
        "kind",
        "target_id",
        "summary",
        "change",
        "note",
        "status",
        "reason"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "kind": {
          "type": "string",
          "enum": [
            "save_custom_field",
            "delete_custom_field",
            "add_site",
            "remove_site",
            "set_guesses",
            "set_multi_step",
            "save_signup_screen",
            "remove_signup_screen",
            "set_custom_field_enabled",
            "set_standard_field",
            "save_signup_form"
          ]
        },
        "target_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "The custom field, site, sign-up screen or sign-up form it changes, if any."
        },
        "summary": {
          "type": "string",
          "description": "The custom field's name, the site, the screen, or the setting's new choice."
        },
        "change": {
          "type": "object",
          "description": "What it changes, as it applies once a lead approves it."
        },
        "note": {
          "type": [
            "string",
            "null"
          ],
          "description": "What the person who asked wrote for the leads."
        },
        "status": {
          "type": "string",
          "enum": [
            "requested",
            "approved",
            "declined",
            "withdrawn",
            "expired",
            "unlocked"
          ]
        },
        "reason": {
          "type": [
            "string",
            "null"
          ],
          "description": "A lead's reason for declining."
        }
      }
    },
    "CustomFieldInput": {
      "type": "object",
      "required": [
        "name",
        "match",
        "value"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "maxLength": 36,
          "description": "The custom field to change."
        },
        "enabled": {
          "type": "boolean",
          "description": "Ignored here, and allowed so a custom field can be sent back as listed. PATCH this path to turn one on or off."
        },
        "name": {
          "type": "string",
          "maxLength": 80
        },
        "match": {
          "type": "object",
          "required": [
            "on",
            "text"
          ],
          "additionalProperties": false,
          "description": "How to recognise the field: words its label or name contains (3 to 100 characters, or 2 in Chinese, Japanese or Korean), with up to 9 more phrases in also, such as its label in other languages; or its exact test ID, name or id attribute; or, for a ready-made custom field, kind with its section as text. Saving replaces the custom field, so send every phrase to keep.",
          "properties": {
            "on": {
              "type": "string",
              "enum": [
                "words",
                "test_id",
                "name",
                "html_id",
                "kind"
              ]
            },
            "text": {
              "type": "string",
              "maxLength": 100
            },
            "also": {
              "type": "array",
              "maxItems": 9,
              "items": {
                "type": "string",
                "maxLength": 100
              },
              "description": "words only: more phrases that recognise the same field, such as its label in the site's other languages."
            }
          }
        },
        "site": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 300,
          "description": "Its host or a site pattern, such as staging.acme.dev or https://*.acme.dev/*, or null for every site. It needn't be one of the project's sites yet; a blocked site is refused."
        },
        "path": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 200,
          "description": "A page path such as /signup. It covers /signup, /signup/business and the same page under a language, such as /de/signup. Leave it out, or send null, for every page of the site."
        },
        "field_type": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "text",
            "textarea",
            "number",
            "select",
            "checkbox",
            "radio",
            null
          ]
        },
        "value": {
          "$ref": "#/$defs/CustomValue"
        },
        "tag_answer": {
          "type": "boolean",
          "description": "An option or one of a list only: tag the account with the answer."
        }
      }
    },
    "CustomValue": {
      "type": "object",
      "required": [
        "kind"
      ],
      "additionalProperties": false,
      "description": "What goes in the field. text: { text }. template: { template } with {first_name}, {last_name}, {full_name}, {username}, {email}, {company}, {country} or {digits:N} (N from 1 to 12). option: { option }, the option to pick. list: { items }, 2 to 20, one picked for each account. options: { options }, 1 to 20, every one for every account: ticks the boxes of a group (matched by their shared name or words in the question they answer) or selects them in a drop-down that takes several answers, and boxes not listed are unticked, though a consent box, a marketing box or a box with its own custom field is left as it is. Never a radio group. checkbox: { checked }. generate: Proxy Mail QA makes up a value that suits the field (the same for the same account), on any field but a checkbox, never a personal ID field. leave: leave the field as it is. ready_made: { section }, matched on kind (or test_id when a sign-up form made it), Proxy Mail QA’s own safe value, where it has one: phone (a number set aside for fiction, or `phones`: the team’s own test number per country), id.national, id.tax, id.passport, business.vat and business.tax (a fake value only where one can never be a real person’s, or `ids_from`: a KYC vendor’s sandbox values), gender, referral_source, language, business.role, business.team_size and business.type (one of the field’s options) and consent.terms (ticked unless `checked` is false).",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "text",
            "template",
            "option",
            "list",
            "options",
            "checkbox",
            "generate",
            "leave",
            "ready_made"
          ]
        },
        "text": {
          "type": "string",
          "maxLength": 200
        },
        "template": {
          "type": "string",
          "maxLength": 200
        },
        "option": {
          "type": "string",
          "maxLength": 100
        },
        "items": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 100
          },
          "minItems": 2,
          "maxItems": 20
        },
        "options": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 100
          },
          "minItems": 1,
          "maxItems": 20
        },
        "checked": {
          "type": "boolean",
          "description": "checkbox, or ready_made consent.terms (true by default)."
        },
        "section": {
          "type": "string",
          "enum": [
            "phone",
            "id.national",
            "id.tax",
            "id.passport",
            "business.vat",
            "business.tax",
            "gender",
            "referral_source",
            "language",
            "business.role",
            "business.team_size",
            "business.type",
            "consent.terms"
          ],
          "description": "ready_made only: the field catalogue section it fills."
        },
        "ids_from": {
          "type": "string",
          "enum": [
            "safe",
            "stripe",
            "plaid",
            "onfido",
            "veriff",
            "didit",
            "cashfree",
            "setu"
          ],
          "description": "ready_made ID and tax numbers only: safe (the default) or a KYC vendor’s sandbox values."
        },
        "phones": {
          "type": "array",
          "maxItems": 20,
          "description": "ready_made phone only: the team’s own test numbers, one per country, for accounts in countries with no numbers set aside for fiction. Never a real person’s number.",
          "items": {
            "type": "object",
            "required": [
              "country",
              "number"
            ],
            "additionalProperties": false,
            "properties": {
              "country": {
                "type": "string",
                "pattern": "^[A-Za-z]{2}$"
              },
              "number": {
                "type": "string",
                "maxLength": 30,
                "description": "4 to 30 digits, spaces, brackets or dashes, with an optional leading +."
              }
            }
          }
        }
      }
    },
    "SignupForm": {
      "allOf": [
        {
          "$ref": "#/$defs/SignupFormSummary"
        },
        {
          "type": "object",
          "properties": {
            "spec": {
              "$ref": "#/$defs/SignupFormSpec"
            },
            "custom_fields": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/CustomFieldInput"
              },
              "description": "The custom fields the form needs."
            },
            "fills": {
              "type": "array",
              "description": "How each field gets its value.",
              "items": {
                "type": "object",
                "properties": {
                  "testid": {
                    "type": "string"
                  },
                  "section": {
                    "type": "string"
                  },
                  "fill": {
                    "type": "string",
                    "enum": [
                      "built_in",
                      "custom_field",
                      "never"
                    ]
                  }
                }
              }
            },
            "requested": {
              "type": "object",
              "description": "What a member asked the leads for, while a request waits.",
              "properties": {
                "name": {
                  "type": "string"
                },
                "spec": {
                  "$ref": "#/$defs/SignupFormSpec"
                },
                "custom_fields": {
                  "type": "array",
                  "items": {
                    "$ref": "#/$defs/CustomFieldInput"
                  }
                }
              }
            },
            "request": {
              "$ref": "#/$defs/ChangeRequest"
            }
          }
        }
      ]
    },
    "SignupFormSpec": {
      "type": "object",
      "description": "The form. Only name and screens are required.",
      "required": [
        "name",
        "screens"
      ],
      "properties": {
        "version": {
          "type": "integer",
          "enum": [
            1
          ]
        },
        "name": {
          "type": "string",
          "maxLength": 80,
          "description": "What the form is called, such as Main sign-up."
        },
        "site": {
          "type": "string",
          "maxLength": 300,
          "description": "The site it's on, as the project lists it, such as https://staging.example.com/*. Leave out to match on every site."
        },
        "language": {
          "type": "string",
          "description": "The form's language, for its default labels: en (the default), de, fr, es, it, pt, nl, zh or ja."
        },
        "country": {
          "type": "string",
          "description": "A two-letter country code for the fields that depend on one (IDs, VAT numbers, phones, addresses)."
        },
        "screens": {
          "type": "array",
          "minItems": 1,
          "maxItems": 10,
          "description": "The screens in order, up to 10, with up to 60 fields in all.",
          "items": {
            "type": "object",
            "required": [
              "fields"
            ],
            "properties": {
              "title": {
                "type": "string",
                "maxLength": 80,
                "description": "The screen's heading."
              },
              "path": {
                "type": "string",
                "description": "The page's path, such as /signup."
              },
              "screen_id": {
                "type": "string",
                "format": "uuid",
                "description": "A sign-up screen the project keeps, from list_sites."
              },
              "fields": {
                "type": "array",
                "minItems": 1,
                "maxItems": 30,
                "description": "The fields in order. Each section once in the form.",
                "items": {
                  "type": "object",
                  "required": [
                    "section"
                  ],
                  "properties": {
                    "section": {
                      "type": "string",
                      "description": "A section id from list_form_sections, such as email, password or business.team_size; or custom, with custom_field, for a question one of the project’s own custom fields answers."
                    },
                    "custom_field": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Section custom only: the custom field that fills it, by its id from list_custom_fields. It keeps deciding the value; the form puts the field in its code, tests and preview. Give the field the test id or label that custom field looks for."
                    },
                    "required": {
                      "type": "boolean",
                      "description": "Defaults to true."
                    },
                    "label": {
                      "type": "string",
                      "maxLength": 80,
                      "description": "The field's label; defaults to the section's label in the form's language. Needed for section custom."
                    },
                    "testid": {
                      "type": "string",
                      "maxLength": 100,
                      "description": "Its data-testid; defaults to signup- and the section id with dashes, such as signup-business-team-size, or for section custom signup- and the label, such as signup-team-size."
                    },
                    "options": {
                      "type": "object",
                      "description": "Only what the section takes.",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "text",
                            "select",
                            "checkbox"
                          ],
                          "description": "Section custom only: a text box, a drop-down (with choices) or a tick box. Defaults to select with choices, else text."
                        },
                        "country": {
                          "type": "string",
                          "description": "A two-letter country code, for a country-dependent section."
                        },
                        "min_length": {
                          "type": "integer",
                          "description": "Password only."
                        },
                        "max_length": {
                          "type": "integer",
                          "description": "Password only."
                        },
                        "classes": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "lower",
                              "upper",
                              "digit",
                              "symbol"
                            ]
                          },
                          "description": "Password only: the kinds of character it must have."
                        },
                        "min_age": {
                          "type": "integer",
                          "description": "Date of birth only: the youngest age the form accepts."
                        },
                        "choices": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "The options of a drop-down or radio group (gender, language, how someone heard, role, team size, or a section custom drop-down)."
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "SignupFormSummary": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "saved",
            "requested",
            "draft"
          ],
          "description": "requested: a lead hasn’t answered yet; draft: asked for and never approved."
        },
        "site": {
          "type": [
            "string",
            "null"
          ]
        },
        "screens": {
          "type": "integer"
        },
        "fields": {
          "type": "integer"
        },
        "created_via": {
          "type": "string",
          "enum": [
            "app",
            "extension",
            "agent",
            "api"
          ]
        },
        "agent_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    }
  }
}