Skip to main content

Create Actor

POST 

/v2/acts

Creates a new Actor with settings specified in an Actor object passed as JSON in the POST payload. The response is the full Actor object as returned by the Get Actor endpoint.

The HTTP request must have the Content-Type: application/json HTTP header!

The Actor needs to define at least one version of the source code. For more information, see Version object.

If you want to make your Actor public using isPublic: true, you will need to provide the Actor's title and the categories under which that Actor will be classified in Apify Store. For this, it's best to use the constants from our apify-shared-js package.

Request

Bodyrequired

  • name string | null nullable
    Example: MyActor
  • description string | null nullable
    Example: My favourite actor!
  • title string | null nullable
    Example: My actor
  • isPublic boolean | null nullable
    Example: false
  • seoTitle string | null nullable
    Example: My actor
  • seoDescription string | null nullable
    Example: My actor is the best
  • restartOnError boolean deprecated
    Example: false
  • versions object[]
    • versionNumber string required
      Example: 0.0
    • sourceType object required
        anyOf
      • VersionSourceType (string)

        Possible values: [SOURCE_FILES, GIT_REPO, TARBALL, GITHUB_GIST]

    • envVars object[]
      • name string required
        Example: MY_ENV_VAR
      • value string required
        Example: my-value
      • isSecret boolean | null nullable
        Example: false
    • applyEnvVarsToBuild boolean | null nullable
      Example: false
    • buildTag string
      Example: latest
    • sourceFiles object[]
        anyOf
      • format SourceCodeFileFormat (string) required

        Possible values: [BASE64, TEXT]


        Example: TEXT
      • content string required
        Example: console.log('This is the main.js file');
      • name string required
        Example: src/main.js
    • gitRepoUrl string | null nullable

      URL of the Git repository when sourceType is GIT_REPO.

    • tarballUrl string | null nullable

      URL of the tarball when sourceType is TARBALL.

    • gitHubGistUrl string | null nullable

      URL of the GitHub Gist when sourceType is GITHUB_GIST.

  • pricingInfos object[]
      oneOf
    • apifyMarginPercentage number required

      In [0, 1], fraction of pricePerUnitUsd that goes to Apify

    • createdAt string<date-time> required

      When this pricing info record has been created

    • startedAt string<date-time> required

      Since when is this pricing info record effective for a given Actor

    • notifiedAboutFutureChangeAt string,null<date-time> nullable
    • notifiedAboutChangeAt string,null<date-time> nullable
    • reasonForChange string | null nullable
    • pricingModel PricingModel (string) required

      Possible values: [PAY_PER_EVENT, PRICE_PER_DATASET_ITEM, FLAT_PRICE_PER_MONTH, FREE]

    • pricingPerEvent object required
      • actorChargeEvents object
        • property name* ActorChargeEvent
          • eventPriceUsd number required
          • eventTitle string required
          • eventDescription string required
    • minimalMaxTotalChargeUsd number | null nullable
  • categories string[] nullable
  • defaultRunOptions object
    • build string required
      Example: latest
    • timeoutSecs integer
      Example: 3600
    • memoryMbytes integer required
      Example: 2048
    • restartOnError boolean
      Example: false

Status 201

Response Headers
  • Location
{
"data": {
"id": "zdc3Pyhyz3m8vjDeM",
"userId": "wRsJZtadYvn4mBZmm",
"name": "MyActor",
"username": "jane35",
"description": "My favourite Actor!",
"isPublic": false,
"createdAt": "2019-07-08T11:27:57.401Z",
"modifiedAt": "2019-07-08T14:01:05.546Z",
"stats": {
"totalBuilds": 9,
"totalRuns": 16,
"totalUsers": 6,
"totalUsers7Days": 2,
"totalUsers30Days": 6,
"totalUsers90Days": 6,
"totalMetamorphs": 2,
"lastRunStartedAt": "2019-07-08T14:01:05.546Z"
},
"versions": [
{
"versionNumber": "0.1",
"envVars": null,
"sourceType": "SOURCE_FILES",
"applyEnvVarsToBuild": false,
"buildTag": "latest",
"sourceFiles": []
},
{
"versionNumber": "0.2",
"sourceType": "GIT_REPO",
"envVars": null,
"applyEnvVarsToBuild": false,
"buildTag": "latest",
"gitRepoUrl": "https://github.com/jane35/my-actor"
},
{
"versionNumber": "0.3",
"sourceType": "TARBALL",
"envVars": null,
"applyEnvVarsToBuild": false,
"buildTag": "latest",
"tarballUrl": "https://github.com/jane35/my-actor/archive/master.zip"
},
{
"versionNumber": "0.4",
"sourceType": "GITHUB_GIST",
"envVars": null,
"applyEnvVarsToBuild": false,
"buildTag": "latest",
"gitHubGistUrl": "https://gist.github.com/jane35/e51feb784yu89"
}
],
"defaultRunOptions": {
"build": "latest",
"timeoutSecs": 3600,
"memoryMbytes": 2048,
"restartOnError": false
},
"exampleRunInput": {
"body": "{ \"helloWorld\": 123 }",
"contentType": "application/json; charset=utf-8"
},
"isDeprecated": false,
"deploymentKey": "ssh-rsa AAAA ...",
"title": "My Actor",
"taggedBuilds": {
"latest": {
"buildId": "z2EryhbfhgSyqj6Hn",
"buildNumber": "0.0.2",
"finishedAt": "2019-06-10T11:15:49.286Z"
}
}
}
}