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

# campaigns

> sift/campaigns/v1/campaigns.proto

<a name="sift_campaigns_v1_campaigns-proto" />

<a name="sift_campaigns_v1_campaigns-proto-services" />

## Services

*RPC methods exposed by this API.*

### CampaignService

| Method                     | Request                                                                 | Response                                                                  | Description                                                                                                                                                                                                                                                   |
| :------------------------- | :---------------------------------------------------------------------- | :------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| GetCampaign                | [GetCampaignRequest](#getcampaignrequest)                               | [GetCampaignResponse](#getcampaignresponse)                               | Retrieve a campaign.                                                                                                                                                                                                                                          |
| CreateCampaign             | [CreateCampaignRequest](#createcampaignrequest)                         | [CreateCampaignResponse](#createcampaignresponse)                         | Create a campaign.                                                                                                                                                                                                                                            |
| ListCampaigns              | [ListCampaignsRequest](#listcampaignsrequest)                           | [ListCampaignsResponse](#listcampaignsresponse)                           | List campaigns.                                                                                                                                                                                                                                               |
| UpdateCampaign             | [UpdateCampaignRequest](#updatecampaignrequest)                         | [UpdateCampaignResponse](#updatecampaignresponse)                         | Updates an existing campaign using the list of fields specified in `update_mask`.                                                                                                                                                                             |
| ListCampaignAnnotations    | [ListCampaignAnnotationsRequest](#listcampaignannotationsrequest)       | [ListCampaignAnnotationsResponse](#listcampaignannotationsresponse)       | List campaigns.                                                                                                                                                                                                                                               |
| GetCampaignReportSummaries | [GetCampaignReportSummariesRequest](#getcampaignreportsummariesrequest) | [GetCampaignReportSummariesResponse](#getcampaignreportsummariesresponse) | Returns per-campaign report summaries (annotation totals + rule classifications) in bulk. Each campaign maps to its list of CampaignReport entries with summary fields populated. Intended for use alongside ListCampaigns with skip\_report\_summaries=true. |

<a name="sift_campaigns_v1_campaigns-proto-messages" />

## Messages

*Data models used across requests/responses.*

### Campaign

| Field                       | Type                                                              | Label    | Description                                                                                                                                                                                                                                                                                 |
| :-------------------------- | :---------------------------------------------------------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| campaign\_id                | string                                                            |          |                                                                                                                                                                                                                                                                                             |
| organization\_id            | string                                                            |          |                                                                                                                                                                                                                                                                                             |
| client\_key                 | string                                                            | optional |                                                                                                                                                                                                                                                                                             |
| name                        | string                                                            |          |                                                                                                                                                                                                                                                                                             |
| description                 | string                                                            | optional |                                                                                                                                                                                                                                                                                             |
| created\_by\_user\_id       | string                                                            |          |                                                                                                                                                                                                                                                                                             |
| modified\_by\_user\_id      | string                                                            |          |                                                                                                                                                                                                                                                                                             |
| created\_date               | google.protobuf.Timestamp                                         |          |                                                                                                                                                                                                                                                                                             |
| modified\_date              | google.protobuf.Timestamp                                         |          |                                                                                                                                                                                                                                                                                             |
| archived\_date              | google.protobuf.Timestamp                                         |          |                                                                                                                                                                                                                                                                                             |
| tags                        | [sift.tags.v1.TagRef](#sift-tags-v1-tagref)                       | repeated |                                                                                                                                                                                                                                                                                             |
| reports                     | [CampaignReport](#campaignreport)                                 | repeated | A campaign, at its core, is a list of reports                                                                                                                                                                                                                                               |
| created\_from\_campaign\_id | string                                                            | optional | If this campaign was created by duplicating another campaign, that other campaign will be referenced here                                                                                                                                                                                   |
| metadata                    | [sift.metadata.v1.MetadataValue](#sift-metadata-v1-metadatavalue) | repeated | User-defined metadata for this campaign                                                                                                                                                                                                                                                     |
| is\_archived                | bool                                                              |          | Whether the campaign. This is inferred from whether archived\_date is set.                                                                                                                                                                                                                  |
| reports\_include\_summaries | bool                                                              |          | Indicates whether the summary fields on CampaignReport (num\_annotations, num\_passed\_rules, num\_accepted\_rules, num\_failed\_rules, num\_open\_rules) are populated. When false, those fields should be ignored -- use GetCampaignReportSummaries to fetch the summary data separately. |

### CampaignReport

A top-level summary of the report's rules is provided here so clients needn't aggregate this information themselves.

| Field                | Type   | Label | Description                                                                                                  |
| :------------------- | :----- | :---- | :----------------------------------------------------------------------------------------------------------- |
| report\_id           | string |       | Direct reference to the report. Set this on the client to tell the backend which report you're referring to. |
| report\_name         | string |       |                                                                                                              |
| num\_annotations     | uint32 |       | How many annotations exist under the report's various rules.                                                 |
| num\_passed\_rules   | uint32 |       | How many rules from this report were never triggered and generated NO annotations.                           |
| num\_accepted\_rules | uint32 |       | How many rules have annotations which are ALL marked as accepted.                                            |
| num\_failed\_rules   | uint32 |       | How many rules have ANY annotations which are marked as failed.                                              |
| num\_open\_rules     | uint32 |       | How many rules have annotations of which SOME are marked as open and NONE are marked as failed.              |

### CampaignReports

Wrapper for repeated CampaignReport used in map values (proto3 maps cannot directly contain repeated fields).

| Field   | Type                              | Label    | Description |
| :------ | :-------------------------------- | :------- | :---------- |
| reports | [CampaignReport](#campaignreport) | repeated |             |

### CreateCampaignFrom

Campaigns can be created from a few different sources.

| Field                              | Type                                                                                | Label | Description                                                                                |
| :--------------------------------- | :---------------------------------------------------------------------------------- | :---- | :----------------------------------------------------------------------------------------- |
| oneof initializer. reports         | [sift.common.type.v1.ResourceIdentifiers](#sift-common-type-v1-resourceidentifiers) |       | Create a campaign directly from a set of reports                                           |
| oneof initializer. runs            | [sift.common.type.v1.ResourceIdentifiers](#sift-common-type-v1-resourceidentifiers) |       | Create a campaign from a set of runs by collecting all the reports generated by those runs |
| oneof initializer. other\_campaign | [sift.common.type.v1.ResourceIdentifier](#sift-common-type-v1-resourceidentifier)   |       | Duplicate another campaign                                                                 |

### CreateCampaignRequest

The request of a call to `CampaignService_CreateCampaign` to create a campaign.

| Field            | Type                                                                      | Label    | Description                                                                                          |
| :--------------- | :------------------------------------------------------------------------ | :------- | :--------------------------------------------------------------------------------------------------- |
| name             | string                                                                    |          | The descriptive display name of the created campaign                                                 |
| description      | string                                                                    | optional | A custom description for the campaign                                                                |
| tags             | [sift.common.type.v1.NamedResources](#sift-common-type-v1-namedresources) |          | Tags to be applied to the new campaign                                                               |
| organization\_id | string                                                                    |          | `organization_id` is only required if your user belongs to multiple organizations                    |
| client\_key      | string                                                                    | optional | User-specified unique identifier.                                                                    |
| create\_from     | [CreateCampaignFrom](#createcampaignfrom)                                 |          | Initialize the campaign, or leave this field empty to create an empty campaign to be populated later |
| metadata         | [sift.metadata.v1.MetadataValue](#sift-metadata-v1-metadatavalue)         | repeated | User-defined metadata for this campaign                                                              |

### CreateCampaignResponse

The response of a call to `CampaignService_CreateCampaign` to create a campaign.

| Field    | Type                  | Label | Description |
| :------- | :-------------------- | :---- | :---------- |
| campaign | [Campaign](#campaign) |       |             |

### GetCampaignReportSummariesRequest

| Field            | Type   | Label    | Description                                                                 |
| :--------------- | :----- | :------- | :-------------------------------------------------------------------------- |
| campaign\_ids    | string | repeated |                                                                             |
| organization\_id | string |          | This field is only required if your user belongs to multiple organizations. |

### GetCampaignReportSummariesResponse

| Field                       | Type                                                                                                                            | Label    | Description                                                                                                                                   |
| :-------------------------- | :------------------------------------------------------------------------------------------------------------------------------ | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------- |
| summaries\_by\_campaign\_id | [GetCampaignReportSummariesResponse.SummariesByCampaignIdEntry](#getcampaignreportsummariesresponse-summariesbycampaignidentry) | repeated | Keyed by campaign\_id. Each value contains the full list of CampaignReport entries for that campaign with summary fields (num\_\*) populated. |

### GetCampaignReportSummariesResponse.SummariesByCampaignIdEntry

| Field | Type                                | Label | Description |
| :---- | :---------------------------------- | :---- | :---------- |
| key   | string                              |       |             |
| value | [CampaignReports](#campaignreports) |       |             |

### GetCampaignRequest

The request for a call to `CampaignService_GetCampaign` to retrieve a campaign.
If `campaign_id` is provided then all other arguments will be ignored.
The `organization_id` argument is only required if using `client_key` and the user belongs to multiple organizations.

| Field                   | Type   | Label | Description                                                                                                                                                                                                                                                                                                                      |
| :---------------------- | :----- | :---- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| campaign\_id            | string |       |                                                                                                                                                                                                                                                                                                                                  |
| client\_key             | string |       |                                                                                                                                                                                                                                                                                                                                  |
| organization\_id        | string |       |                                                                                                                                                                                                                                                                                                                                  |
| skip\_report\_summaries | bool   |       | If `true`, the response will omit the summary fields on the campaign's reports and set reports\_include\_summaries to false on the Campaign message. Reports will still be included with report\_id and report\_name populated. This significantly improves response times for campaigns with many reports. Defaults to `false`. |

### GetCampaignResponse

The response of a call to `CampaignService_GetCampaign` to retrieve a campaign.

| Field    | Type                  | Label | Description |
| :------- | :-------------------- | :---- | :---------- |
| campaign | [Campaign](#campaign) |       |             |

### ListCampaignAnnotationsRequest

| Field        | Type   | Label | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| :----------- | :----- | :---- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| campaign\_id | string |       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| page\_size   | uint32 |       | The maximum number of annotations to return. The service may return fewer than this value. If unspecified, at most 50 annotations will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. Optional.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| page\_token  | string |       | A page token, received from a previous `ListAnnotations` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListAnnotations` must match the call that provided the page token. Optional.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| filter       | string |       | A [Common Expression Language (CEL)](https://github.com/google/cel-spec) filter string. Available fields to filter by are `annotation_id`, `start_time`, `end_time`, `created_date`, `modified_date`, `run_id`, `name`, `description`, `state`, `created_by_user_id`, `created_by_rule_condition_version_id`, `annotation_type`, `tag_name`, `report_id`, `asset_id`, `asset_name`, `pending`, `assignee`, and `metadata`. For further information about how to use CELs, please refer to [this guide](https://github.com/google/cel-spec/blob/master/doc/langdef.md#standard-definitions). For more information about the fields used for filtering, please refer to [this definition](/docs/api/grpc/protocol-buffers/annotations#annotation). Optional. |
| order\_by    | string |       | How to order the retrieved annotations. Formatted as a comma-separated string i.e. "FIELD\_NAME\[ desc],...". Available fields to order\_by are `created_date`, `modified_date`, `start_time`, and `end_time`. If left empty, items are ordered by `created_date` in ascending order (oldest-first). For more information about the format of this field, read [this](https://google.aip.dev/132#ordering) Example: "created\_date desc,modified\_date"                                                                                                                                                                                                                                                                                                    |

### ListCampaignAnnotationsResponse

| Field             | Type                                                              | Label    | Description |
| :---------------- | :---------------------------------------------------------------- | :------- | :---------- |
| annotations       | [sift.annotations.v1.Annotation](#sift-annotations-v1-annotation) | repeated |             |
| next\_page\_token | string                                                            |          |             |

### ListCampaignsRequest

The request for a call to `CampaignService_ListCampaigns` to retrieve campaigns.

| Field                   | Type   | Label | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| :---------------------- | :----- | :---- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| page\_size              | uint32 |       | The maximum number of campaigns to return. The service may return fewer than this value. If unspecified, at most 50 campaigns will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. Optional.                                                                                                                                                                                                                                                                                                                                       |
| page\_token             | string |       | A page token, received from a previous `ListCampaigns` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListCampaigns` must match the call that provided the page token. Optional.                                                                                                                                                                                                                                                                                                                              |
| filter                  | string |       | A [Common Expression Language (CEL)](https://github.com/google/cel-spec) filter string. Available fields to filter by are: `created_by_user_id`, `tag_id`, `tag_name`, `report_id`, `report_name`, `campaign_id`, `client_key`, `description`, `run_id`, `name`, `is_archived`, and `metadata`. For further information about how to use CELs, please refer to [this guide](https://github.com/google/cel-spec/blob/master/doc/langdef.md#standard-definitions). For more information about the fields used for filtering, please refer to this definition. Optional. |
| organization\_id        | string |       | This field is only required if your user belongs to multiple organizations.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| include\_archived       | bool   |       | If `true` then archived campaigns will be included in the query. Defaults to `false`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| order\_by               | string |       | How to order the retrieved campaigns. Formatted as a comma-separated string i.e. "FIELD\_NAME\[ desc],...". Available fields to order\_by are `name`, `created_date` and `modified_date`. If left empty, items are ordered by `created_date` in descending order (newest-first). For more information about the format of this field, read [this](https://google.aip.dev/132#ordering) Example: "created\_date desc,modified\_date"                                                                                                                                   |
| skip\_report\_summaries | bool   |       | If `true`, the response will omit the summary fields on each campaign's reports and set reports\_include\_summaries to false on the Campaign message. Reports will still be included with report\_id and report\_name populated. This significantly improves response times for campaigns with many reports. Defaults to `false`.                                                                                                                                                                                                                                     |

### ListCampaignsResponse

The response of a call to `CampaignService_ListCampaignsResponse`.

| Field             | Type                  | Label    | Description |
| :---------------- | :-------------------- | :------- | :---------- |
| campaigns         | [Campaign](#campaign) | repeated |             |
| next\_page\_token | string                |          |             |

### UpdateCampaignRequest

The request for a call to `CampaignService_UpdateCampaign` to update a campaign. When updating
tags or rules, the update will perform a full replace. Additionally, when updating rules, only the rule ID or the rule client key
is required, but it is okay to provide both. If some rules contain only client keys and others only rule IDs, they will be consolidated.

| Field        | Type                                                    | Label | Description                                                                                                                                                        |
| :----------- | :------------------------------------------------------ | :---- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| campaign     | [Campaign](#campaign)                                   |       | The campaign to update.                                                                                                                                            |
| update\_mask | [google.protobuf.FieldMask](#google-protobuf-fieldmask) |       | The list of fields to be updated. The fields available to be updated are `name`, `archived_date`, `is_archived`, `description`, `tags`, `reports`, and `metadata`. |

### UpdateCampaignResponse

The response of a call to `CampaignService_UpdateCampaign`.

| Field    | Type                  | Label | Description |
| :------- | :-------------------- | :---- | :---------- |
| campaign | [Campaign](#campaign) |       |             |

<a name="sift_campaigns_v1_campaigns-proto-enums" />

## Enums

*Allowed constant values used in message fields.*
