Apify

Learn how to use Apify with Composio

Overview

SLUG: APIFY

Description

Apify is a platform for building, deploying, and managing web scraping and automation tools, known as Actors.

Authentication Details

generic_api_key
stringRequired
generic_token
stringRequired

Connecting to Apify

Create an auth config

Use the dashboard to create an auth config for the Apify toolkit. This allows you to connect multiple Apify accounts to Composio for agents to use.

1

Select App

Navigate to Apify.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Apify Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using API Key

1from composio import Composio
2
3# Replace these with your actual values
4apify_auth_config_id = "ac_YOUR_APIFY_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/app
6
7composio = Composio()
8
9def authenticate_toolkit(user_id: str, auth_config_id: str):
10 # Replace this with a method to retrieve an API key from the user.
11 # Or supply your own.
12 user_api_key = input("[!] Enter API key")
13
14 connection_request = composio.connected_accounts.initiate(
15 user_id=user_id,
16 auth_config_id=auth_config_id,
17 config={"auth_scheme": "API_KEY", "val": user_api_key}
18 )
19
20 # API Key authentication is immediate - no redirect needed
21 print(f"Successfully connected Apify for user {user_id}")
22 print(f"Connection status: {connection_request.status}")
23
24 return connection_request.id
25
26
27connection_id = authenticate_toolkit(user_id, apify_auth_config_id)
28
29# You can verify the connection using:
30connected_account = composio.connected_accounts.get(connection_id)
31print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Apify toolkit’s playground

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["APIFY"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Create Actor

Description

Tool to create a new actor with specified configuration. use when you need to initialize a fresh actor programmatically before publishing or running it.

Action Parameters

categories
array
defaultRunOptions
object
description
string
isDeprecated
boolean
isPublic
boolean
name
stringRequired
title
string
versions
array

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Dataset

Description

Tool to create a new dataset. use when you need to initialize or retrieve a dataset by name.

Action Parameters

name
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Actor Task

Description

Tool to create a new actor task with specified settings. use when you need to configure or schedule recurring actor runs programmatically.

Action Parameters

actId
stringRequired
name
stringRequired
options
object

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Task Webhook

Description

Tool to create a webhook for an actor task. use when you need external notifications about task run events (e.g., completion or failure) in downstream systems.

Action Parameters

condition
objectRequired
description
string
eventTypes
arrayRequired
headersTemplate
string
idempotencyKey
string
isAdHoc
boolean
payloadTemplate
string
requestUrl
stringRequired
shouldInterpolateStrings
boolean

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Actor

Description

Tool to delete an actor permanently. use when you need to remove an actor by its id or username~actorname. confirm before calling.

Action Parameters

actorId
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Webhook

Description

Tool to delete a webhook by its id. use when removing a webhook after confirming the webhook id.

Action Parameters

webhookId
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Actor Details

Description

Tool to get details of a specific actor. use when you need actor metadata by id or username/actorname.

Action Parameters

actorId
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get all webhooks

Description

Tool to get a list of all webhooks created by the user. use when you need to enumerate webhooks before filtering or maintenance.

Action Parameters

desc
boolean
limit
integer
offset
integer

Action Response

data
arrayRequired
error
string
limit
integerRequired
offset
integerRequired
successful
booleanRequired
total
integerRequired

Tool Name: Get dataset items

Description

Tool to retrieve items from a dataset. use when you need to fetch data from a specified dataset by pagination or filtering. only json format is fully supported.

Action Parameters

asciiHeaders
boolean
attachment
boolean
bom
boolean
clean
boolean
datasetId
stringRequired
delimiter
string
desc
boolean
fields
string
flatten
boolean
format
stringDefaults to json
limit
integerDefaults to 1000
offset
integer
offsetKey
string
omit
string
skipEmpty
boolean
skipHidden
boolean
unwind
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Default Build

Description

Tool to get the default build for an actor. use after specifying the actor id; optionally wait for the build to finish before returning.

Action Parameters

actorId
stringRequired
waitForFinish
number

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Key-Value Record

Description

Tool to retrieve a record from a key-value store. use when you need to fetch a specific value by key from an apify key-value store.

Action Parameters

attachment
boolean
disableRedirect
boolean
format
string
recordKey
stringRequired
storeId
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get list of builds

Description

Tool to get a list of builds for a specific actor. use when you need paginated access to an actor’s build (version) history.

Action Parameters

actorId
stringRequired
desc
boolean
limit
integer
offset
integer
status
string
unnamed
boolean
waitForFinish
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get list of runs

Description

Tool to get a list of runs for a specific actor. use when you need to paginate through runs and optionally filter by status before processing run data.

Action Parameters

actorId
stringRequired
desc
boolean
limit
integerDefaults to 1000
offset
integer
status
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get list of tasks

Description

Tool to fetch a paginated list of tasks belonging to the authenticated user. use when you need to browse or sort tasks created by the user.

Action Parameters

desc
boolean
limit
integerDefaults to 1000
offset
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get list of task runs

Description

Tool to get a list of runs for a specific actor task. use when you need to paginate through task runs and optionally filter by status.

Action Parameters

actorTaskId
stringRequired
desc
boolean
limit
integerDefaults to 1000
offset
integer
status
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get list of task webhooks

Description

Tool to get a list of webhooks for a specific actor task. use when you need to review or paginate webhooks after creating or updating a task.

Action Parameters

actorTaskId
stringRequired
desc
boolean
limit
integerDefaults to 1000
offset
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get log

Description

Tool to retrieve logs for a specific actor run or build. use after initiating an actor run or build when you need to inspect execution logs.

Action Parameters

buildOrRunId
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get OpenAPI Definition

Description

Tool to get the openapi definition for a specific actor build. use when you need the api schema for code generation or analysis.

Action Parameters

actorId
stringRequired
buildId
stringRequired
token
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Task Input

Description

Tool to retrieve the input configuration of a specific task. use when you need to inspect stored task input before execution or debugging.

Action Parameters

taskId
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Resurrect Run

Description

Tool to resurrect a finished actor run. use when you need to restart a completed or failed run. deprecated endpoint; may be removed in future.

Action Parameters

runId
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Run Actor Asynchronously

Description

Tool to run a specific actor asynchronously. use when you need to trigger an actor run without waiting for completion and retrieve its run details immediately.

Action Parameters

actorId
stringRequired
body
object
build
string
maxItems
number
maxTotalChargeUsd
number
memory
number
timeout
number
waitForFinish
number
webhooks
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Run Actor Sync

Description

Tool to run a specific actor synchronously with input and return its output record. use when immediate actor results are needed; runs may timeout after 300 seconds.

Action Parameters

actorId
stringRequired
build
string
input
objectRequired
maxItems
integer
maxTotalChargeUsd
number
memory
integer
outputRecordKey
string
timeout
number
webhooks
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Run Actor Sync & Get Dataset Items

Description

Tool to run an actor synchronously and retrieve its dataset items. use when immediate access to run results is needed.

Action Parameters

actorId
stringRequired
format
stringDefaults to json
input
object
limit
integerDefaults to 100
offset
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Run Task Asynchronously

Description

Tool to run a specific actor task asynchronously. use when you need to trigger a task run without waiting for completion and immediately retrieve its run details.

Action Parameters

actorTaskId
stringRequired
body
object
build
string
maxItems
number
maxTotalChargeUsd
number
memory
number
timeout
number
waitForFinish
number
webhooks
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Store Data in Dataset

Description

Tool to store data items in a dataset. use after collecting data when you want to batch-append or update items in an existing dataset.

Action Parameters

data
arrayRequired
datasetId
stringRequired
deduplicate
boolean
fields
string
omit
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Store Data in Key-Value Store

Description

Tool to create or update a record in a key-value store. use after you have the store id and record key to persist json data.

Action Parameters

recordKey
stringRequired
recordValue
objectRequired
storeId
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Key-Value Store

Description

Tool to update a key-value store's properties. use when renaming or changing access or schema version of the store after confirming the store id.

Action Parameters

access
string
name
string
schemaVersion
integer
storeId
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Task Input

Description

Tool to update the input configuration of a specific actor task. use when you need to modify a scheduled tasks input before execution.

Action Parameters

input
objectRequired
taskId
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired