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

# AutoBill.addCampaign

The `addCampaign` method allows you to add a Campaign to an existing `AutoBill`.

This method will automatically validate the Campaign, and its eligibility, before adding the Campaign, and updating the AutoBill, and will not change the billing date for the AutoBill.

**Note:** If neither *product* nor *item* is passed in with this call, Subscribe will apply the Campaign discount to all eligible items on the AutoBill.

## Input

*srd*: sparse response description, a SOAP string (which must be a JSON object), in which you specify the elements you want returned.This parameter enables the calling system to constrain a `method` call to return only components you specify. This gives you greater control over returned content, and improves response time within the Vindicia platform by reducing the processing needed for the call.

Some fields are required, either practically or in the WSDL, and will be returned regardless of the *srd*. A null *srd* returns the complete response.

*autobill*: the object of type `AutoBill` to which this Campaign should be added.

*product*: a `Product` to which the Campaign discount should be applied. (This product must already exist in Subscribe.) The discount will be applied to any `AutoBillItem` on the specified AutoBill that includes this product. Specify either *item* or *product*; but not both. (**Optional.**)

*item*: the `AutoBillItem` to which the Campaign discount should be applied. This item must already exist in Subscribe and be associated with the specified AutoBill. Specify either *item* or *product*; but not both. (**Optional.**)

*applyToBillingPlan*: a Boolean flag that, if set to `true`, will apply the `Campaign` to the `BillingPlan` on the `AutoBill`. (May be combined with a discounted `AutoBillItem`.) Default is `false`.

*campaignCode*: the Coupon or Promotion Code used to obtain a discount on the `AutoBill`. (**Required**.)

*dryrun*: a Boolean flag that, if set to `true`, will return the updated `AutoBill`, without recording the result in the Subscribe database. Use this method to compute the cost of an `AutoBill` without committing the change. (The projected billing amount will be returned in the `Transaction` object of the `nextBilling` data member of the returned `AutoBill`.)

If the `AutoBill` did not exist before, it will not exist afterward; if it did exist before, it will not change. (No payment method validations, authorizations or charges will be performed if *dryrun* is `true`.)

## Output

*return*: an object of type `Return` that indicates the success or failure of the call.

*autobill*: the updated `AutoBill`.

## Returns

In addition to those listed in [The Return Object](The_Return_Object), this call returns:

| Return Code | Return String |
| - | - |
| `400` | One of the following: - `AutoBill not found.` - `Campaign code *input-campaignCode* is not usable.` - `Must specify a campaignCode with addCampaign.` |

## Example

```

$autobill = new AutoBill();
   $autobill->set($abID); // for some $abID
   $response = $autobill->addCampaign(
      'promoABC',
   );

   // check $response
```

**Parent topic:**[AutoBill Methods](../topics/AutoBill_Methods)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.