1 get:
2 operationId: GetCampaigns
3 summary: List Campaigns
4 description: >-
5 Retrieve a list of campaigns. The campaigns can be filtered by fields such
6 as `id`. The campaigns can also be sorted or paginated.
7 x-authenticated: true
8 parameters:
9 - name: fields
10 in: query
11 description: >-
12 Comma-separated fields that should be included in the returned data. if
13 a field is prefixed with `+` it will be added to the default fields,
14 using `-` will remove it from the default fields. without prefix it will
15 replace the entire default fields.
16 required: false
17 schema:
18 type: string
19 title: fields
20 description: >-
21 Comma-separated fields that should be included in the returned data.
22 if a field is prefixed with `+` it will be added to the default
23 fields, using `-` will remove it from the default fields. without
24 prefix it will replace the entire default fields.
25 externalDocs:
26 url: '#select-fields-and-relations'
27 - name: offset
28 in: query
29 description: The number of items to skip when retrieving a list.
30 required: false
31 schema:
32 type: number
33 title: offset
34 description: The number of items to skip when retrieving a list.
35 externalDocs:
36 url: '#pagination'
37 - name: limit
38 in: query
39 description: Limit the number of items returned in the list.
40 required: false
41 schema:
42 type: number
43 title: limit
44 description: Limit the number of items returned in the list.
45 externalDocs:
46 url: '#pagination'
47 - name: order
48 in: query
49 description: >-
50 The field to sort the data by. By default, the sort order is ascending.
51 To change the order to descending, prefix the field name with `-`.
52 required: false
53 schema:
54 type: string
55 title: order
56 description: >-
57 The field to sort the data by. By default, the sort order is
58 ascending. To change the order to descending, prefix the field name
59 with `-`.
60 - name: with_deleted
61 in: query
62 description: Whether to include deleted records in the result.
63 required: false
64 schema:
65 type: boolean
66 title: with_deleted
67 description: Whether to include deleted records in the result.
68 - name: q
69 in: query
70 description: Apply a search query to the campaign's searchable properties.
71 required: false
72 schema:
73 type: string
74 title: q
75 description: Apply a search query to the campaign's searchable properties.
76 - name: campaign_identifier
77 in: query
78 description: Filter by a campaign identifier.
79 required: false
80 schema:
81 type: string
82 title: campaign_identifier
83 description: Filter by a campaign identifier.
84 - name: budget
85 in: query
86 description: Filter by the campaign's budget.
87 required: false
88 schema:
89 type: object
90 description: Filter by the campaign's budget.
91 properties:
92 currency_code:
93 type: string
94 title: currency_code
95 description: The budget's currency code.
96 example: usd
97 - name: $and
98 in: query
99 description: >-
100 Join query parameters with an AND condition. Each object's content is
101 the same type as the expected query parameters.
102 required: false
103 schema:
104 type: array
105 description: >-
106 Join query parameters with an AND condition. Each object's content is
107 the same type as the expected query parameters.
108 items:
109 type: object
110 title: $and
111 - name: $or
112 in: query
113 description: >-
114 Join query parameters with an OR condition. Each object's content is the
115 same type as the expected query parameters.
116 required: false
117 schema:
118 type: array
119 description: >-
120 Join query parameters with an OR condition. Each object's content is
121 the same type as the expected query parameters.
122 items:
123 type: object
124 title: $or
125 security:
126 - api_token: []
127 - cookie_auth: []
128 - jwt_token: []
129 x-codeSamples:
130 - lang: JavaScript
131 label: JS SDK
132 source:
133 $ref: ../code_samples/JavaScript/admin_campaigns/get.js
134 - lang: Shell
135 label: cURL
136 source:
137 $ref: ../code_samples/Shell/admin_campaigns/get.sh
138 tags:
139 - Campaigns
140 responses:
141 '200':
142 description: OK
143 content:
144 application/json:
145 schema:
146 allOf:
147 - type: object
148 description: The paginated list of campaigns.
149 required:
150 - limit
151 - offset
152 - count
153 properties:
154 limit:
155 type: number
156 title: limit
157 description: The maximum number of items retrieved.
158 offset:
159 type: number
160 title: offset
161 description: The number of its skipped before the returned items.
162 count:
163 type: number
164 title: count
165 description: The total number of items.
166 - type: object
167 description: The list of campaigns
168 required:
169 - campaigns
170 properties:
171 campaigns:
172 type: array
173 description: The list of campaigns.
174 items:
175 $ref: ../components/schemas/CampaignResponse.yaml
176 '400':
177 $ref: ../components/responses/400_error.yaml
178 '401':
179 $ref: ../components/responses/unauthorized.yaml
180 '404':
181 $ref: ../components/responses/not_found_error.yaml
182 '409':
183 $ref: ../components/responses/invalid_state_error.yaml
184 '422':
185 $ref: ../components/responses/invalid_request_error.yaml
186 '500':
187 $ref: ../components/responses/500_error.yaml
188 post:
189 operationId: PostCampaigns
190 summary: Create Campaign
191 description: Create a campaign.
192 x-authenticated: true
193 parameters:
194 - name: fields
195 in: query
196 description: >-
197 Comma-separated fields that should be included in the returned data. if
198 a field is prefixed with `+` it will be added to the default fields,
199 using `-` will remove it from the default fields. without prefix it will
200 replace the entire default fields.
201 required: false
202 schema:
203 type: string
204 title: fields
205 description: >-
206 Comma-separated fields that should be included in the returned data.
207 if a field is prefixed with `+` it will be added to the default
208 fields, using `-` will remove it from the default fields. without
209 prefix it will replace the entire default fields.
210 externalDocs:
211 url: '#select-fields-and-relations'
212 security:
213 - api_token: []
214 - cookie_auth: []
215 - jwt_token: []
216 requestBody:
217 content:
218 application/json:
219 schema:
220 allOf:
221 - type: object
222 description: The campaign's details.
223 required:
224 - name
225 - campaign_identifier
226 - description
227 - budget
228 - starts_at
229 - ends_at
230 properties:
231 name:
232 type: string
233 title: name
234 description: The campaign's name.
235 campaign_identifier:
236 type: string
237 title: campaign_identifier
238 description: The campaign's identifier.
239 description:
240 type: string
241 title: description
242 description: The campaign's description.
243 budget:
244 type: object
245 description: >-
246 The campaign's budget which, when crossed, ends the
247 campaign.
248 required:
249 - type
250 - limit
251 - currency_code
252 properties:
253 type:
254 type: string
255 title: type
256 description: >
257 The budget's type. This can't be edited later. Use
258 `spend` to set a limit on the total amount discounted by
259 the campaign's promotions. Use `usage` to set a limit on
260 the total number of times the campaign's promotions can
261 be used.
262 enum:
263 - spend
264 - usage
265 limit:
266 type: number
267 title: limit
268 description: The campaign budget's limit.
269 currency_code:
270 type: string
271 title: currency_code
272 description: >-
273 The campaign budget's currency code. This can't be
274 edited later.
275 starts_at:
276 type: string
277 title: starts_at
278 description: The campaign's start date.
279 format: date-time
280 ends_at:
281 type: string
282 title: ends_at
283 description: The campaign's end date.
284 format: date-time
285 promotions:
286 type: array
287 description: The campaign's promotions.
288 items:
289 type: object
290 description: The promotions to add to the campaign.
291 required:
292 - id
293 properties:
294 id:
295 type: string
296 title: id
297 description: A promotion's ID.
298 - type: object
299 description: The campaign's details.
300 properties:
301 additional_data:
302 type: object
303 description: >-
304 Pass additional custom data to the API route. This data is
305 passed to the underlying workflow under the
306 `additional_data` parameter.
307 description: The campaign's details.
308 x-codeSamples:
309 - lang: JavaScript
310 label: JS SDK
311 source:
312 $ref: ../code_samples/JavaScript/admin_campaigns/post.js
313 - lang: Shell
314 label: cURL
315 source:
316 $ref: ../code_samples/Shell/admin_campaigns/post.sh
317 tags:
318 - Campaigns
319 responses:
320 '200':
321 description: OK
322 content:
323 application/json:
324 schema:
325 $ref: ../components/schemas/AdminCampaignResponse.yaml
326 '400':
327 $ref: ../components/responses/400_error.yaml
328 '401':
329 $ref: ../components/responses/unauthorized.yaml
330 '404':
331 $ref: ../components/responses/not_found_error.yaml
332 '409':
333 $ref: ../components/responses/invalid_state_error.yaml
334 '422':
335 $ref: ../components/responses/invalid_request_error.yaml
336 '500':
337 $ref: ../components/responses/500_error.yaml
338 x-workflow: createCampaignsWorkflow
339 x-events: []