v3

latestOpenAPI 3.1.2Apache 2.02026-07-31231237972.0 KB
Actors/Actor versions

Create version

Creates a version of an Actor using values specified in a Version object passed as JSON in the POST payload.

The request must specify versionNumber and sourceType parameters (as strings) in the JSON payload and a Content-Type: application/json HTTP header.

Each sourceType requires its own additional properties to be passed to the JSON payload object. These are outlined in the Version object table below and in more detail in the Apify documentation.

For example, if an Actor's source code is stored in a GitHub repository, you will set the sourceType to GIT_REPO and pass the repository's URL in the gitRepoUrl property.

{
    "versionNumber": "0.1",
    "sourceType": "GIT_REPO",
    "gitRepoUrl": "https://github.com/my-github-account/actor-repo"
}

The response is the Version object as returned by the Get version endpoint.

post/v2/actors/{actorId}/versions

Path parameters

actorIdstring required
Example:janedoe~my-actor

Actor ID or a tilde-separated owner's username and Actor name.

Request body

versionNumberstring nullable

The version number of the Actor. Two numbers separated by a dot, that represent the MAJOR.MINOR part of the semantic versioning.

sourceType'SOURCE_FILES' | 'GIT_REPO' | 'TARBALL' | 'GITHUB_GIST' | 'SOURCE_CODE'
applyEnvVarsToBuildboolean nullable

Whether to inject the environment variables at build time.

buildTagstring nullable

The tag name to apply to a successful build of this version. Can be null when the version has no build tag.

gitRepoUrlstring nullable

URL of the Git repository to clone the source code from. Applies when the sourceType is GIT_REPO.

tarballUrlstring nullable

URL of the tarball to download the source code from. Applies when the sourceType is TARBALL.

gitHubGistUrlstring nullable

URL of the GitHub Gist to clone the source code from. Applies when the sourceType is GITHUB_GIST.

Example request

{
  "versionNumber": "1.6",
  "envVars": [
    {
      "name": "MY_ENV_VAR",
      "value": "my-value"
    }
  ],
  "buildTag": "latest",
  "sourceFiles": [
    {
      "format": "TEXT",
      "content": "console.log('This is the main.js file');",
      "name": "src/main.js"
    }
  ]
}

Response

Example response

{
  "data": {
    "versionNumber": "0.0",
    "envVars": [
      {
        "name": "MY_ENV_VAR",
        "value": "my-value"
      }
    ],
    "buildTag": "latest",
    "sourceFiles": [
      {
        "format": "TEXT",
        "content": "console.log('This is the main.js file');",
        "name": "src/main.js"
      }
    ]
  }
}