
Pay per event example
This Actor is paid per event

Pay per event example
This Actor is paid per event
This is an example pay-per-event Actor. When running it, you don't pay for the underlying platform usage, just for the Actor start event, and trivia facts it generates.
You can access the Pay per event example programmatically from your own applications by using the Apify API. You can choose the language preference from below. To use the Apify API, you’ll need an Apify account and your API token, found in Integrations settings in Apify Console.
1{
2 "openapi": "3.0.1",
3 "info": {
4 "version": "0.1",
5 "x-build-id": "aFnt1rtbbrqJbzBDD"
6 },
7 "servers": [
8 {
9 "url": "https://api.apify.com/v2"
10 }
11 ],
12 "paths": {
13 "/acts/mhamas~pay-per-event-example/run-sync-get-dataset-items": {
14 "post": {
15 "operationId": "run-sync-get-dataset-items-mhamas-pay-per-event-example",
16 "x-openai-isConsequential": false,
17 "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
18 "tags": [
19 "Run Actor"
20 ],
21 "requestBody": {
22 "required": true,
23 "content": {
24 "application/json": {
25 "schema": {
26 "$ref": "#/components/schemas/inputSchema"
27 }
28 }
29 }
30 },
31 "parameters": [
32 {
33 "name": "token",
34 "in": "query",
35 "required": true,
36 "schema": {
37 "type": "string"
38 },
39 "description": "Enter your Apify token here"
40 }
41 ],
42 "responses": {
43 "200": {
44 "description": "OK"
45 }
46 }
47 }
48 },
49 "/acts/mhamas~pay-per-event-example/runs": {
50 "post": {
51 "operationId": "runs-sync-mhamas-pay-per-event-example",
52 "x-openai-isConsequential": false,
53 "summary": "Executes an Actor and returns information about the initiated run in response.",
54 "tags": [
55 "Run Actor"
56 ],
57 "requestBody": {
58 "required": true,
59 "content": {
60 "application/json": {
61 "schema": {
62 "$ref": "#/components/schemas/inputSchema"
63 }
64 }
65 }
66 },
67 "parameters": [
68 {
69 "name": "token",
70 "in": "query",
71 "required": true,
72 "schema": {
73 "type": "string"
74 },
75 "description": "Enter your Apify token here"
76 }
77 ],
78 "responses": {
79 "200": {
80 "description": "OK",
81 "content": {
82 "application/json": {
83 "schema": {
84 "$ref": "#/components/schemas/runsResponseSchema"
85 }
86 }
87 }
88 }
89 }
90 }
91 },
92 "/acts/mhamas~pay-per-event-example/run-sync": {
93 "post": {
94 "operationId": "run-sync-mhamas-pay-per-event-example",
95 "x-openai-isConsequential": false,
96 "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
97 "tags": [
98 "Run Actor"
99 ],
100 "requestBody": {
101 "required": true,
102 "content": {
103 "application/json": {
104 "schema": {
105 "$ref": "#/components/schemas/inputSchema"
106 }
107 }
108 }
109 },
110 "parameters": [
111 {
112 "name": "token",
113 "in": "query",
114 "required": true,
115 "schema": {
116 "type": "string"
117 },
118 "description": "Enter your Apify token here"
119 }
120 ],
121 "responses": {
122 "200": {
123 "description": "OK"
124 }
125 }
126 }
127 }
128 },
129 "components": {
130 "schemas": {
131 "inputSchema": {
132 "type": "object",
133 "required": [
134 "trivia"
135 ],
136 "properties": {
137 "trivia": {
138 "title": "Which cool facts you would like to generate?",
139 "type": "array",
140 "description": "Tell the Actor what kind of cool trivia you'd like to generate. You can generate trivia from lord-of-the-rings, harry-potter, or star-wards. See the prefilled input for example."
141 }
142 }
143 },
144 "runsResponseSchema": {
145 "type": "object",
146 "properties": {
147 "data": {
148 "type": "object",
149 "properties": {
150 "id": {
151 "type": "string"
152 },
153 "actId": {
154 "type": "string"
155 },
156 "userId": {
157 "type": "string"
158 },
159 "startedAt": {
160 "type": "string",
161 "format": "date-time",
162 "example": "2025-01-08T00:00:00.000Z"
163 },
164 "finishedAt": {
165 "type": "string",
166 "format": "date-time",
167 "example": "2025-01-08T00:00:00.000Z"
168 },
169 "status": {
170 "type": "string",
171 "example": "READY"
172 },
173 "meta": {
174 "type": "object",
175 "properties": {
176 "origin": {
177 "type": "string",
178 "example": "API"
179 },
180 "userAgent": {
181 "type": "string"
182 }
183 }
184 },
185 "stats": {
186 "type": "object",
187 "properties": {
188 "inputBodyLen": {
189 "type": "integer",
190 "example": 2000
191 },
192 "rebootCount": {
193 "type": "integer",
194 "example": 0
195 },
196 "restartCount": {
197 "type": "integer",
198 "example": 0
199 },
200 "resurrectCount": {
201 "type": "integer",
202 "example": 0
203 },
204 "computeUnits": {
205 "type": "integer",
206 "example": 0
207 }
208 }
209 },
210 "options": {
211 "type": "object",
212 "properties": {
213 "build": {
214 "type": "string",
215 "example": "latest"
216 },
217 "timeoutSecs": {
218 "type": "integer",
219 "example": 300
220 },
221 "memoryMbytes": {
222 "type": "integer",
223 "example": 1024
224 },
225 "diskMbytes": {
226 "type": "integer",
227 "example": 2048
228 }
229 }
230 },
231 "buildId": {
232 "type": "string"
233 },
234 "defaultKeyValueStoreId": {
235 "type": "string"
236 },
237 "defaultDatasetId": {
238 "type": "string"
239 },
240 "defaultRequestQueueId": {
241 "type": "string"
242 },
243 "buildNumber": {
244 "type": "string",
245 "example": "1.0.0"
246 },
247 "containerUrl": {
248 "type": "string"
249 },
250 "usage": {
251 "type": "object",
252 "properties": {
253 "ACTOR_COMPUTE_UNITS": {
254 "type": "integer",
255 "example": 0
256 },
257 "DATASET_READS": {
258 "type": "integer",
259 "example": 0
260 },
261 "DATASET_WRITES": {
262 "type": "integer",
263 "example": 0
264 },
265 "KEY_VALUE_STORE_READS": {
266 "type": "integer",
267 "example": 0
268 },
269 "KEY_VALUE_STORE_WRITES": {
270 "type": "integer",
271 "example": 1
272 },
273 "KEY_VALUE_STORE_LISTS": {
274 "type": "integer",
275 "example": 0
276 },
277 "REQUEST_QUEUE_READS": {
278 "type": "integer",
279 "example": 0
280 },
281 "REQUEST_QUEUE_WRITES": {
282 "type": "integer",
283 "example": 0
284 },
285 "DATA_TRANSFER_INTERNAL_GBYTES": {
286 "type": "integer",
287 "example": 0
288 },
289 "DATA_TRANSFER_EXTERNAL_GBYTES": {
290 "type": "integer",
291 "example": 0
292 },
293 "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
294 "type": "integer",
295 "example": 0
296 },
297 "PROXY_SERPS": {
298 "type": "integer",
299 "example": 0
300 }
301 }
302 },
303 "usageTotalUsd": {
304 "type": "number",
305 "example": 0.00005
306 },
307 "usageUsd": {
308 "type": "object",
309 "properties": {
310 "ACTOR_COMPUTE_UNITS": {
311 "type": "integer",
312 "example": 0
313 },
314 "DATASET_READS": {
315 "type": "integer",
316 "example": 0
317 },
318 "DATASET_WRITES": {
319 "type": "integer",
320 "example": 0
321 },
322 "KEY_VALUE_STORE_READS": {
323 "type": "integer",
324 "example": 0
325 },
326 "KEY_VALUE_STORE_WRITES": {
327 "type": "number",
328 "example": 0.00005
329 },
330 "KEY_VALUE_STORE_LISTS": {
331 "type": "integer",
332 "example": 0
333 },
334 "REQUEST_QUEUE_READS": {
335 "type": "integer",
336 "example": 0
337 },
338 "REQUEST_QUEUE_WRITES": {
339 "type": "integer",
340 "example": 0
341 },
342 "DATA_TRANSFER_INTERNAL_GBYTES": {
343 "type": "integer",
344 "example": 0
345 },
346 "DATA_TRANSFER_EXTERNAL_GBYTES": {
347 "type": "integer",
348 "example": 0
349 },
350 "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
351 "type": "integer",
352 "example": 0
353 },
354 "PROXY_SERPS": {
355 "type": "integer",
356 "example": 0
357 }
358 }
359 }
360 }
361 }
362 }
363 }
364 }
365 }
366}
Pay per event example OpenAPI definition
OpenAPI is a standard for designing and describing RESTful APIs, allowing developers to define API structure, endpoints, and data formats in a machine-readable way. It simplifies API development, integration, and documentation.
OpenAPI is effective when used with AI agents and GPTs by standardizing how these systems interact with various APIs, for reliable integrations and efficient communication.
By defining machine-readable API specifications, OpenAPI allows AI models like GPTs to understand and use varied data sources, improving accuracy. This accelerates development, reduces errors, and provides context-aware responses, making OpenAPI a core component for AI applications.
You can download the OpenAPI definitions for Pay per event example from the options below:
If you’d like to learn more about how OpenAPI powers GPTs, read our blog post.
You can also check out our other API clients:
Actor Metrics
1 monthly user
-
3 bookmarks
>99% runs succeeded
47 days response time
Created in Sep 2024
Modified 4 months ago