Skip to content

Commit 54fe91e

Browse files
authored
feat: add API documentation for Actor charge (#1325)
1 parent 12f27b8 commit 54fe91e

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
title: ChargeRunRequest
2+
required:
3+
- eventName
4+
- eventCount
5+
type: object
6+
properties:
7+
eventName:
8+
type: string
9+
example: ANALYZE_PAGE
10+
eventCount:
11+
type: number
12+
example: 1

apify-api/openapi/components/tags.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,10 @@
620620
x-displayName: Resurrect run
621621
x-parent-tag-name: Actor runs
622622
x-trait: 'true'
623+
- name: Actor runs/Charge events in run
624+
x-displayName: Charge events in run
625+
x-parent-tag-name: Actor runs
626+
x-trait: 'true'
623627
- name: Actor runs/Update status message
624628
x-displayName: Update status message
625629
x-parent-tag-name: Actor runs

apify-api/openapi/components/x-tag-groups.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
- Actor runs/Metamorph run
4141
- Actor runs/Reboot run
4242
- Actor runs/Resurrect run
43+
- Actor runs/Charge events in run
4344
- Actor runs/Update status message
4445
- name: Actor builds
4546
tags:

apify-api/openapi/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,8 @@ paths:
544544
$ref: paths/actor-runs/actor-runs@{runId}@reboot.yaml
545545
'/v2/actor-runs/{runId}/resurrect':
546546
$ref: paths/actor-runs/actor-runs@{runId}@resurrect.yaml
547+
'/v2/actor-runs/{runId}/charge':
548+
$ref: paths/actor-runs/actor-runs@{runId}@charge.yaml
547549
/v2/actor-builds:
548550
$ref: paths/actor-builds/actor-builds.yaml
549551
'/v2/actor-builds/{buildId}':
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
post:
2+
tags:
3+
- Actor runs/Charge events in run
4+
summary: Charge events in run
5+
description: |
6+
Charge for events in the run of your [pay per event Actor](https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event).
7+
The event you are charging for must be one of the configured events in your Actor. If the Actor is not set up as pay per event, or if the event is not configured,
8+
the endpoint will return an error. The endpoint must be called from the Actor run itself, with the same API token that the run was started with.
9+
10+
Note that pay per events Actors are still in alpha. Please, reach out to us with any questions or feedback.
11+
operationId: PostChargeRun
12+
parameters:
13+
- name: runId
14+
in: path
15+
required: true
16+
schema:
17+
type: string
18+
example: 3KH8gEpp4d8uQSe8T
19+
description: Run ID.
20+
- name: idempotency-key
21+
in: header
22+
required: false
23+
schema:
24+
type: string
25+
example: 2024-12-09T01:23:45.000Z-random-uuid
26+
description: Always pass a unique idempotency key (any unique string) for each charge to avoid double charging in case of retries or network errors.
27+
requestBody:
28+
description: 'Define which event, and how many times, you want to charge for.'
29+
content:
30+
application/json:
31+
schema:
32+
$ref: "../../components/schemas/actor-runs/ChargeRunRequest.yaml"
33+
example:
34+
eventName: 'ANALYZE_PAGE'
35+
eventCount: 1
36+
required: true
37+
responses:
38+
'201':
39+
description: 'The charge was successful. Note that you still have to make sure in your Actor that the total charge for the run respects the maximum value set by the user, as the API does not check this. Above the limit, the charges reported as successful in API will not be added to your payouts, but you will still bear the associated costs. Use the Apify charge manager or SDK to avoid having to deal with this manually.'
40+
deprecated: false
41+
x-js-parent: RunClient
42+
x-js-name: charge
43+
x-js-doc-url: https://docs.apify.com/api/client/js/reference/class/RunClient#charge
44+
x-py-parent: RunClientAsync
45+
x-py-name: charge
46+
x-py-doc-url: https://docs.apify.com/api/client/python/reference/class/RunClientAsync#charge

0 commit comments

Comments
 (0)