# `ApifyClient.API.Actors.Versions`
[🔗](https://github.com/social-growth-studio/apify-client-ex/blob/v1.0.0/lib/apify_client/api/actors/versions.ex#L1)

Provides API endpoints related to api/actors/versions

# `build_on_push`

```elixir
@spec build_on_push(
  actor_id :: String.t(),
  version_number :: String.t(),
  body :: map() | ApifyClient.Schemas.UpdateBuildOnPushRequest.t(),
  opts :: keyword()
) :: :ok | {:error, ApifyClient.Error.t()}
```

Update Actor version build on push

Turns automatic builds on push on or off for an Actor version whose source is a git repository.

Enabling registers a push webhook on the repository through the connected git account given by `providerId`, so
that every push to the repository builds the version. Disabling turns the webhook off on GitHub, or removes it
on GitLab and Bitbucket.

You need write access to the Actor. The version must have its source type set to a git repository, and the
connected account must have permission to manage the repository's webhooks.

## Request Body

**Content Types**: `application/json`

# `create`

```elixir
@spec create(
  actor_id :: String.t(),
  body :: map() | ApifyClient.Schemas.CreateVersionRequest.t(),
  opts :: keyword()
) :: {:ok, ApifyClient.Schemas.Version.t()} | {:error, ApifyClient.Error.t()}
```

Create Actor 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](https://docs.apify.com/platform/actors/development/deployment/source-types).

For example, if an Actor's source code is stored in a [GitHub
repository](https://docs.apify.com/platform/actors/development/deployment/source-types#git-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"
}
```

If the Actor is in a subdirectory of the uploaded `SOURCE_FILES` or
`TARBALL` source, such as in a monorepo, set `actorPath` to that
directory, for example `"actorPath": "actors/typescript-actor"`.

The response is the `Version` object as
returned by the [Get Actor version](https://docs.apify.com/api/v2/actor-version-get) endpoint.

## Request Body

**Content Types**: `application/json`

# `delete`

```elixir
@spec delete(actor_id :: String.t(), version_number :: String.t(), opts :: keyword()) ::
  :ok | {:error, ApifyClient.Error.t()}
```

Delete Actor version

Deletes a specific version of Actor's source code.

# `get`

```elixir
@spec get(actor_id :: String.t(), version_number :: String.t(), opts :: keyword()) ::
  {:ok, ApifyClient.Schemas.Version.t()} | {:error, ApifyClient.Error.t()}
```

Get Actor version

Gets a `Version` object that contains all the details about a specific version of an Actor.

# `list`

```elixir
@spec list(actor_id :: String.t(), opts :: keyword()) ::
  {:ok, ApifyClient.Schemas.ListOfVersions.t()}
  | {:error, ApifyClient.Error.t()}
```

Get list of Actor versions

Gets the list of versions of a specific Actor. The response is a JSON object
with the list of `Version` objects, where each
contains basic information about a single version.

# `update`

```elixir
@spec update(
  actor_id :: String.t(),
  version_number :: String.t(),
  body :: map() | ApifyClient.Schemas.UpdateVersionRequest.t(),
  opts :: keyword()
) :: {:ok, ApifyClient.Schemas.Version.t()} | {:error, ApifyClient.Error.t()}
```

Update Actor version

Updates Actor version using values specified by a `Version` object passed as JSON in the POST payload.

If the object does not define a specific property, its value will not be
updated.

An update that sends `sourceType`, `sourceFiles`, or `tarballUrl` without
`actorPath` removes the version's stored `actorPath`. For a monorepo
version, send `actorPath` again with every upload.

The request needs to specify the `Content-Type: application/json` HTTP
header!

When providing your API authentication token, we recommend using the
request's `Authorization` header, rather than the URL.
For details, see [Authentication](https://docs.apify.com/api/v2#authentication).

The response is the `Version` object as
returned by the [Get Actor version](https://docs.apify.com/api/v2/actor-version-get) endpoint.

## Request Body

**Content Types**: `application/json`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
