> ## Documentation Index
> Fetch the complete documentation index at: https://docs.campaigncleaner.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Send Campaign

> The **send_campaign** API Endpoint allows you to send in a campaign to be processed and analyzed by [Campaign Cleaner](https://campaigncleaner.com). Below is the list of settings that can be set, all optional settings, if not specified will default to the bold/italicized setting.

All submitted campaigns will be sanitized.
#### Header:
**X-CC-API-Key**: Your API Key
#### Request Body:

_Required:_

**send_campaign**:

- **campaign_html** : The full HTML of your campaign
- **campaign_name**: The name of your campaign - campaign name must pass our sanitization checks.
 

Campaigns are normally processed in under 2 minutes, in most instances in a few seconds. But in some cases with very large campaigns with lots of images and links it can take longer to check those links for blacklists, redirects. image sizes and more. Depending on the server where those links resources are located it can take longer. The send campaign, will return a campaign ID once we received it, you can use that campaign ID to check on the status, and retrieve your campaign when it's finished processing or you can supply us a webhook URL and we will send the results to you automatically.

_Optional:_

**send_campaign**:

- **adjust_font_colors**: (_**true**_/false), If true, certain bright colors are spam triggers, like "**red**" or "**#FF0000**", will be adjusted to a slightly different color like "**#FF0101"**, it will look the same, but won't trigger some spam filters.
- **adjust_font_size**: (_**true**_/false) If true, you will be able to define the min and max font size allowed in pixels. If your newsletter contains larger or small font's it will adjust them to the min/max you define.
- **convert_h_to_p_tags**: (true/**false**) If true, this will change all the H tags to P tags and set the correct font-size.
- **convert_tables_to_divs:** (true/**false**) - This is an experimental feature to convert all the tables to divs, in certain instances with a complicated table structure you might need to edit the HTML. We recommend leaving this as false or not setting it.
- **custom_info:** This field is for you to pass any additional data you want to send us, it will also be passed back to you when you call the get_campaign API. It's limited to 500 characters. - It must pass our sanitization checks.
- **host_extensionless_images:** (true/**false**) If true, images without extensions will be hosted on our CDN when the **resize_and_host** parameter is set to true. Typically, dynamically generated images lack extensions, though there are exceptions.
- **inline_css:** (**true**/false) When set to true, CSS styles are directly applied within the style attribute of each HTML element.
- **inline_css_important:** (true/**false**) When set to true, the `!important` flag will also be inlined with CSS styles. If you are using media queries, it is generally recommended to keep this set to false.
- **media_queries_important:** (**true**/false) When set to true, all media query styles will be marked with the `!important` flag. This ensures they can override any inline CSS without an `!important` flag.
- **image_max_width:** (int) When this is specified, it will add an max-width style to all images. it is not desirable for the image width to exceed the default campaign width.
- **min_font_size_allowed**: (_**10**_) (A positive Integer, under 100) The **min_font_size** must be smaller or equal to the **max_font_size** in pixels
- **max_font_size_allowed**: (_**32**_) (A positive Integer under 100) The **max_font_size** must be larger or equal to the **min_font_size** in pixels
- **preserve_media_queries**: (_**true**_/false) True, if media queries should be preserved.
- **remove_classes_and_ids**: (_**true**_/false) If true, removes all the class and ID attributes after CSS Inlining.
- **remove_comments**: (_**true**_/false), If true, comments are stripped from both CSS and HTML. Comments are invisible in html and can trigger spam filters.
- **remove_css_inheritance**: (_**true**_/false) If true, removes all elements of CSS that are inherited. Once CSS is inlined, the inherited CSS will be removed, for example if font-size of a parent tag is 15 pixels, there is no need for the font-size of the child tag to be specified as 15 pixels because it's inherited or computed from the parent tag, this reduces the size of your HTML Campaign.
- **remove_control_non_printable:** (**true**/false) If true, all non-printable and control characters are removed.
- **remove_image_height:** (true/**false**) If true, the height style is removed from all images, preventing any image distortions. Only the width property should be set on images sent in emails.
- **remove_large_widths_over**: (integer) Experimental: If sets removes all defined widths over the value set on non images and table tags.
- **remove_successive_punctuation**: (true/**false**) If true, this will remove succession punctuation like ..., !!!!, $$$ to a single occurrence.
- **relative_links_base_url**: If set, this needs to be a full base URL like "[https://campaigncleaner.com/"](https://campaigncleaner.com/), if your email campaign has any relative paths, it will be converted to an absolute URL. In most instances, you won't need to set this.
- **replace_diacritics**: (**true**/false) If true, replaces diacritic characters like á with normal characters equivalent, if you're sending emails in English emails, this is a must.
- **replace_non_ascii_characters**: (**true**/false) If true, replaces all non-ascii characters with their ascii equivalent. For example, ❝ will be replaced with **".** Non-ascii characters is of of the major spam trigger.
- **resize_and_host**: (true/**false**) If true, we will resize, convert, and host all eligible images on our CDN. Please read our documentation here: [Resizing and Hosting](https://docs.campaigncleaner.com/features-settings/resize-and-host)
- **surrounding_div:** When you set any parameter of the surrounding div, it will add "div" tag around your html with the styles you set. This is helpful to set default styles and conditions that can affect the look of your html.
  - **max_width:** The max-width style applied to the surrounding "div" can be specified in pixels as an integer value. It is typically set to the desired maximum width of the campaign, which is commonly either 600 or 900 pixels.
  - **text_align**: (left, center, right) All content within the surrounding "div" will be aligned according to your specified style. However, you can use the "text-align" property on inner tags within the "div" to customize the appearance of your email.
  - **font_size:** The pixel size that you want everything in the surrounding div to adhere to, setting this, will add an "_!important"_ to the font-size in the surrounding "div". Font sizes that are set on any tag in the HTML will retain their original size. While all unspecified font sizes to the size you chose.
  - **center_to_parent:** (true/false) Using this feature will enable the surrounding "div" to be centered in any parent tags in which it is placed. This is particularly helpful when inserting an HTML snippet into a template.

- **webhook_url**: An endpoint that you provide us and when your campaign is fully processed we will send the results back that is found in the Get Campaign API. You can utilize the webhook section under API Management to troubleshoot and test your endpoint.
 
#### Header:
**X-CC-API-Key**: Your API Key
#### Response:

**campaign:**

- **id**: The campaign id that will be used to retrieve your campaign using the get_campaign API.



## OpenAPI

````yaml POST /v1/send_campaign
openapi: 3.0.0
info:
  title: API DOCUMENTATION
  description: >-


    [Campaign Cleaner](https://campaigncleaner.com) is the leader in ensuring
    that your campaigns don't affect your IP and Domain reputation, it's the
    most advanced toolset you'll find that gives you all the tools you need to
    keep your campaigns within acceptable ratios of many email and spam
    filtering software and automatically fixes your HTML by sanitizing all
    non-email friendly attributes and inlines all your CSS to be compatible with
    every email client.


    We offer a robust collection of API's to allow you to integrate its
    functionality into your email marketing software and tools.


    The **{{api_key}}** is located in your account on [Campaign
    Cleaner](https://campaigncleaner.com) under **API Management API Keys.**


    Use the navigation on the left to access the different API Endpoints.
  version: 1.0.0
servers:
  - url: https://api.campaigncleaner.com
security: []
paths:
  /v1/send_campaign:
    post:
      tags:
        - Campaign Cleaner
      summary: Send Campaign
      description: >-
        The **send_campaign** API Endpoint allows you to send in a campaign to
        be processed and analyzed by [Campaign
        Cleaner](https://campaigncleaner.com). Below is the list of settings
        that can be set, all optional settings, if not specified will default to
        the bold/italicized setting.


        All submitted campaigns will be sanitized.

        #### Header:

        **X-CC-API-Key**: Your API Key

        #### Request Body:


        _Required:_


        **send_campaign**:


        - **campaign_html** : The full HTML of your campaign

        - **campaign_name**: The name of your campaign - campaign name must pass
        our sanitization checks.
         

        Campaigns are normally processed in under 2 minutes, in most instances
        in a few seconds. But in some cases with very large campaigns with lots
        of images and links it can take longer to check those links for
        blacklists, redirects. image sizes and more. Depending on the server
        where those links resources are located it can take longer. The send
        campaign, will return a campaign ID once we received it, you can use
        that campaign ID to check on the status, and retrieve your campaign when
        it's finished processing or you can supply us a webhook URL and we will
        send the results to you automatically.


        _Optional:_


        **send_campaign**:


        - **adjust_font_colors**: (_**true**_/false), If true, certain bright
        colors are spam triggers, like "**red**" or "**#FF0000**", will be
        adjusted to a slightly different color like "**#FF0101"**, it will look
        the same, but won't trigger some spam filters.

        - **adjust_font_size**: (_**true**_/false) If true, you will be able to
        define the min and max font size allowed in pixels. If your newsletter
        contains larger or small font's it will adjust them to the min/max you
        define.

        - **convert_h_to_p_tags**: (true/**false**) If true, this will change
        all the H tags to P tags and set the correct font-size.

        - **convert_tables_to_divs:** (true/**false**) - This is an experimental
        feature to convert all the tables to divs, in certain instances with a
        complicated table structure you might need to edit the HTML. We
        recommend leaving this as false or not setting it.

        - **custom_info:** This field is for you to pass any additional data you
        want to send us, it will also be passed back to you when you call the
        get_campaign API. It's limited to 500 characters. - It must pass our
        sanitization checks.

        - **host_extensionless_images:** (true/**false**) If true, images
        without extensions will be hosted on our CDN when the resize_and_host
        parameter is set to true.

        - **inline_css:** (**true**/false) When set to true, CSS styles are
        directly applied within the style attribute of each HTML element.

        - **inline_css_important:** (true/**false**) When set to true, the
        !important flag will also be inlined with CSS styles.

        - **max_font_size_allowed**: (A positive Integer under 100) in pixels,
        default is 32.

        - **media_queries_important:** (**true**/false) When set to true, all
        media query styles will be marked with the !important flag.

        - **min_font_size_allowed**: (A positive Integer, under 100) in pixels,
        default is 10.

        - **preserve_media_queries**: (**true**/false) If true, all media
        queries will be preserved.

        - **relative_links_base_url**: If set, this needs to be a full base URL,
        if your email campaign has any relative paths, it will be converted to
        an absolute URL.

        - **remove_classes_and_ids**: (_**true**_/false) If true, all the class
        and ID attributes after CSS Inlining will be removed.

        - **remove_comments**: (**true**/false) If true, comments will be
        stripped from both CSS and HTML.

        - **remove_control_non_printable:** (true/**false**) If True, all
        non-printable and control characters are removed.

        - **remove_css_inheritance**: (**true**/false) If true, removes all
        elements of CSS that are inherited.

        - **remove_image_height:** (**true**/false) if true, the height style
        will be removed from all images.

        - **remove_large_widths_over**: (integer) Experimental: If set, removes
        all defined widths over the value set on non images and table tags.

        - **remove_successive_punctuation**: (**true**/false) if true, this will
        remove successive punctuation like ..., !!!!, $$$ to a single
        occurrence.

        - **replace_diacritics**: (**true**/false) If true, diacritic characters
        like á will be replaced with normal character equivalents.

        - **replace_non_ascii_characters**: (**true**/false) If true, all
        non-ascii characters will be replaced with their ascii equivalent.

        - **resize_and_host**: (**true**/false) If true, all eligible images
        will be resized, converted, and hosted on our CDN.

        - **set_image_max_width**: (integer) If set, applies a max-width style
        to all images in pixels.

        - **surrounding_div**: A surrounding div added to your html.
           - **max_width**: The max-width style in pixels applied to the surrounding div.
           - **text_align**: (left, center, right) Alignment of content within the div.
           - **font_size**: The pixel size set in the surrounding div.
           - **center_to_parent**: (true/false) If true, centers the div in any parent tags.

        - **webhook_url**: If provided, the results will be posted to this URL
        when processing is complete. Must be an absolute URL with no query
        string.
      parameters:
        - name: X-CC-API-Key
          in: header
          schema:
            type: string
          example: '{{api_key}}'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                send_campaign:
                  campaign_html: <html><body>Your Campaign HTML</body></html>
                  campaign_name: My Campaign
                  adjust_font_colors: true
                  adjust_font_size: true
                  min_font_size_allowed: 10
                  max_font_size_allowed: 32
                  convert_h_to_p_tags: false
                  convert_tables_to_divs: false
                  custom_info: ''
                  host_extensionless_images: false
                  inline_css: true
                  inline_css_important: false
                  media_queries_important: true
                  preserve_media_queries: true
                  relative_links_base_url: ''
                  remove_classes_and_ids: true
                  remove_comments: true
                  remove_control_non_printable: false
                  remove_css_inheritance: true
                  remove_image_height: true
                  remove_successive_punctuation: true
                  replace_diacritics: true
                  replace_non_ascii_characters: true
                  resize_and_host: true
                  webhook_url: ''
                  surrounding_div:
                    max_width: 600
                    text_align: left
                    font_size: 15
                    center_to_parent: true
      responses:
        '200':
          description: OK
          headers:
            Content-Type:
              schema:
                type: string
                example: application/json
          content:
            application/json:
              schema:
                type: object
              example:
                campaign:
                  id: 8e754ce1-c2df-11ed-9848-003048d8d533

````