How to set a form's style/theme using an API?

  • docaugai
    Asked on August 8, 2025 at 3:08 PM

    I am creating a Jotform form from the Python package. However, setting the form's style does not work and the form is created with the default style (which is unacceptable to our use-case). Here is a code example:

        form_questions = {}
        form_questions['0'] = {
            'type': 'control_head',
            'text': f'Form title',
            'order': '0',
            'name': 'form_header'
        }
        for i, question in enumerate(questions):
            question_type = type_mapping.get(question.data_type)
            if not question_type:
                # Default to textbox for any unmapped types
                question_type = 'control_textbox'


            jotform_question = {
                'type': question_type,
                'text': question.prompt,
                'order': str(i + 1),
                'name': f'q{i+1}_{question.prompt.replace(" ", "_").lower()}'
            }


            # Specific configurations for certain types
            if question.data_type == PythonDataType.BOOLEAN:
                jotform_question['options'] = 'Yes|No'
           
            if question.data_type == PythonDataType.DATE:
                jotform_question['allowTime'] = 'No' # Disable time for date-only questions


            form_questions[str(i+1)] = jotform_question
        if True:
            # Add a submit button at the end of the form
            form_questions[str(len(questions))] = {
                'type': 'control_button',
                'text': 'Submit',
                'order': str(len(questions) + 1),
                'name': 'submit_button'
            }
        form_payload = {
            'properties': {
                'title': f'form title',
                'email': 'my@email.com',
                "styles": "Baby Blue",
            },
            'questions': form_questions
        }
        created_form = jotform_client.create_form(form_payload)


    I tried various values from api.jotform.com/docs/properties/index.php?field=form but none of them work.

    I tried to ask your AI assistant but its suggestions also did not work.

    Thanks

  • Joeni JotForm Support
    Replied on August 8, 2025 at 3:34 PM

    Hi docaugai,

    Thanks for reaching out to Jotform Support. Currently, applying a style or theme directly through the API by setting a style property in the form payload is not supported. As a result, the form is created with the default style, even if different values are provided.

    As a workaround, after creating the form via API, you can manually apply a theme using the Jotform Form Builder's Form Designer. This lets you choose from available themes and styles to customize the form's look and feel. Let me show you how:

    1. In Form Builder, click on the Paint Roller icon in the upper right side of the panel to open the Form Designer Menu and go to the Themes tab.

    How to set a forms style/theme using an API? Image 1 Screenshot 30 Also, to customize the form's appearance programmatically, consider Injecting Custom CSS. Note that this is only supported in Classic Form Layouts, not in Card Forms. To enable CSS injection, switch your form layout to Classic. Let me show you how:

    1. Click on the Paint Roller icon in the upper right side of the panel and go to the Layout tab and select the Classic Form option.

    How to set a forms style/theme using an API? Image 2 Screenshot 41 Let us know if you have any other questions.

  • docaugai
    Replied on August 8, 2025 at 6:10 PM

    Thanks for the explanation!

    Is there any way to customize styling without requiring a manual action for each form? Even setting a default style for the whole account will work.

    From what I could read there is no option to inject CSS via the API, so that won't solve the need for automatically applied styling - Happy to learn otherwise.


  • Keenly JotForm Support
    Replied on August 8, 2025 at 6:29 PM

    Hi docaugai,

    To confirm what my colleague shared, you can’t inject or apply custom CSS to the form via API. I’ve also moved your other question into a new thread so we can focus on it properly. You can view and follow it here.

    Let us know if you have any other questions.


  • docaugai
    Replied on August 9, 2025 at 11:52 AM

    Hi Keenly,

    Thanks for the info. That's unfortunate but I understand the limitation. Ticket can be closed. The same as the other thread.

Your Reply