Create version
POST/v2/acts/:actorId/versions
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.
Request
Path Parameters
Actor ID or a tilde-separated owner's username and Actor name.
Example:janedoe~my-actorBodyrequired
- versionNumber string | null nullableExample:
0.0 sourceType object
- anyOf
- VersionSourceType
- null
- VersionSourceType (string)
Possible values: [
SOURCE_FILES,GIT_REPO,TARBALL,GITHUB_GIST]
envVars object[]
- name string requiredExample:
MY_ENV_VAR - value string requiredExample:
my-value - isSecret boolean | null nullableExample:
false
- name string requiredExample:
- applyEnvVarsToBuild boolean | null nullableExample:
false - buildTag string | null nullableExample:
latest sourceFiles object[]
- anyOf
- SourceCodeFile
- SourceCodeFolder
- format SourceCodeFileFormat (string) required
Possible values: [
Example:BASE64,TEXT]TEXT - content string requiredExample:
console.log('This is the main.js file'); - name string requiredExample:
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.
Status 201
Response Headers
- Location
{
"data": {
"versionNumber": "0.0",
"sourceType": "SOURCE_FILES",
"envVars": "Unknown Type: array,null",
"applyEnvVarsToBuild": false,
"buildTag": "latest",
"sourceFiles": [
{
"format": "TEXT",
"content": "console.log('This is the main.js file');",
"name": "src/main.js"
},
{
"name": "src/utils",
"folder": true
}
],
"gitRepoUrl": "string",
"tarballUrl": "string",
"gitHubGistUrl": "string"
}
}
Schema
data object required
- versionNumber string requiredExample:
0.0 sourceType object required
- anyOf
- VersionSourceType
- null
- VersionSourceType (string)
Possible values: [
SOURCE_FILES,GIT_REPO,TARBALL,GITHUB_GIST]
envVars object[]
- name string requiredExample:
MY_ENV_VAR - value string requiredExample:
my-value - isSecret boolean | null nullableExample:
false
- name string requiredExample:
- applyEnvVarsToBuild boolean | null nullableExample:
false - buildTag stringExample:
latest sourceFiles object[]
- anyOf
- SourceCodeFile
- SourceCodeFolder
- format SourceCodeFileFormat (string) required
Possible values: [
Example:BASE64,TEXT]TEXT - content string requiredExample:
console.log('This is the main.js file'); - name string requiredExample:
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.
- versionNumber string requiredExample:
Status 400
Bad request - invalid input parameters or request body.
{
"error": {
"type": "invalid-input",
"message": "Invalid input: The request body contains invalid data."
}
}
Schema
error object required
- type string requiredExample:
run-failed - message string requiredExample:
Actor run did not succeed (run ID: 55uatRrZib4xbZs, status: FAILED)
- type string requiredExample:
Status 401
Unauthorized - authentication required or invalid token.
{
"error": {
"type": "token-not-valid",
"message": "Authentication token is not valid."
}
}
Schema
error object required
- type string requiredExample:
run-failed - message string requiredExample:
Actor run did not succeed (run ID: 55uatRrZib4xbZs, status: FAILED)
- type string requiredExample:
Status 403
Forbidden - insufficient permissions to perform this action.
{
"error": {
"type": "permission-denied",
"message": "You do not have permission to perform this action."
}
}
Schema
error object required
- type string requiredExample:
run-failed - message string requiredExample:
Actor run did not succeed (run ID: 55uatRrZib4xbZs, status: FAILED)
- type string requiredExample:
Status 404
Not found - the requested resource was not found.
{
"error": {
"type": "actor-not-found",
"message": "Actor was not found"
}
}
Schema
error object
- type string
Possible values: [
actor-not-found] - message stringExample:
Actor was not found
- type string
Status 405
Method not allowed.
{
"error": {
"type": "method-not-allowed",
"message": "This API end-point can only be accessed using the following HTTP methods: OPTIONS,GET"
}
}
Schema
error object required
- type string requiredExample:
run-failed - message string requiredExample:
Actor run did not succeed (run ID: 55uatRrZib4xbZs, status: FAILED)
- type string requiredExample:
Status 413
Payload too large - the request body exceeds the size limit.
{
"error": {
"type": "request-too-large",
"message": "The POST payload is too large (limit: 9437184 bytes, actual length: 10485760 bytes)."
}
}
Schema
error object required
- type string requiredExample:
run-failed - message string requiredExample:
Actor run did not succeed (run ID: 55uatRrZib4xbZs, status: FAILED)
- type string requiredExample:
Status 415
Unsupported media type - the Content-Encoding of the request is not supported.
{
"error": {
"type": "unsupported-content-encoding",
"message": "Content-Encoding \"bla\" is not supported."
}
}
Schema
error object required
- type string requiredExample:
run-failed - message string requiredExample:
Actor run did not succeed (run ID: 55uatRrZib4xbZs, status: FAILED)
- type string requiredExample:
Status 429
Too many requests - rate limit exceeded.
{
"error": {
"type": "rate-limit-exceeded",
"message": "You have exceeded the rate limit. Please try again later."
}
}
Schema
error object required
- type string requiredExample:
run-failed - message string requiredExample:
Actor run did not succeed (run ID: 55uatRrZib4xbZs, status: FAILED)
- type string requiredExample: