API Reference

You can use the API to configure which HTML elements should be included or excluded from audio generation.

For example, if you want to exclude <h2> subheadings from audio generation, you can add a filter to do so.

{
  "element_type": "h2",
  "include": false,
}

To make HTML filters as flexible as possible, you can define them based on the following:

  • element_type: <H2>, <blockquote>, <ul>, <table> etc.
  • element_class: .header, .footer, .aside etc.
  • element_id: #advert, #related, #navigation etc.
  • element_data: data-include, data-exclude etc.
  • element_xpath: //*[@role='dialog'] etc.
  • value: “Sponsored” etc

You can also combine attributes to create more targeted filters. For example, to exclude only <h3> subheadings with the class “header” that contain the word “title”:

{
  "element_type": "h3",
  "element_class": "header",
  "value": "title",
  "include": false,
}

Note: Other than with element_xpath, when specifying elements, classes, or other HTML attributes, provide only the name or identifier. Do not include prefix characters such as <, ., #, or any other syntax.