Streaming live at 10am (PST)

API - How to upload Rich Text as code snipped, and not just as regular text?

Hello, I am using webflow API to create new items of a collection. Every Item as some javascript code that is very unique.

When manually setting up each item, I can have a rich text field that is set as code and accepts all my javascript code. (see picture below)

However, when using the API to create fields, there is no option to select upload rich text as a “code snippet”.

Any hints?

Thank you

@Vasco_Ramalho - I am pretty sure that this is not possible and it is a feature only available via the designer.

A possible workaround is to create a text field to hold the content. You can use it in a template but just have to decode it since Webflow encodes HTML on render. If you needed the code rendered inside the contents of a RTF you would need a target to replace in your code. Something like decode the element, look for a string that was used as a target, then replace the target with the decoded code block.