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

Provides API endpoints related to api/actors/builds

# `create`

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

Build Actor

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

## Options

  * `version`: Actor version number to be built.
  * `use_cache`: If `true` or `1`, the system will use a cache to speed up the build
    process. Pass `false` or `0` to build without the cache. By default,
    cache is used.
    
  * `beta_packages`: If `true` or `1` then the Actor is built with beta versions of Apify NPM
    packages. By default, the build uses `latest` packages.
    
  * `tag`: Tag to be applied to the build on success. By default, the tag is taken
    from Actor version's `buildTag` property.
    
  * `wait_for_finish`: The maximum number of seconds the server waits for the build to finish.
    By default it is `0`, the maximum value is `60`. <!-- MAX_ACTOR_JOB_ASYNC_WAIT_SECS -->
    If the build finishes in time then the returned build object will have a
    terminal status (e.g. `SUCCEEDED`), otherwise it will have a transitional status (e.g. `RUNNING`).
    

# `default`

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

Get default Actor build

Get the default build for an Actor.

Use the optional `waitForFinish` parameter to synchronously wait for the build to finish.
This avoids the need for periodic polling when waiting for the build to complete.

This endpoint does not require an authentication token. Instead, calls are authenticated using the Actor's unique ID.
However, if you access the endpoint without a token, certain attributes (e.g., `usageUsd` and `usageTotalUsd`) will be hidden.

## Options

  * `wait_for_finish`: The maximum number of seconds the server waits for the build to finish.
    By default it is `0`, the maximum value is `60`. <!-- MAX_ACTOR_JOB_ASYNC_WAIT_SECS -->
    If the build finishes in time then the returned build object will have a
    terminal status (e.g. `SUCCEEDED`), otherwise it will have a transitional status (e.g. `RUNNING`).
    

# `list`

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

Get list of Actor's builds

Gets the list of builds of a specific Actor. The response is a JSON with the
list of objects, where each object contains basic information about a single build.

The endpoint supports pagination using the `limit` and `offset` parameters
and it will not return more than 1000 records.

By default, the records are sorted by the `startedAt` field in ascending order,
therefore you can use pagination to incrementally fetch all builds while new
ones are still being started. To sort the records in descending order, use
the `desc=1` parameter.

## Options

  * `offset`: Number of items that should be skipped at the start. The default value is `0`.
    
  * `limit`: Maximum number of items to return. The default value as well as the maximum is `1000`.
    
  * `desc`: If `true` or `1` then the objects are sorted by the `startedAt` field in
    descending order. By default, they are sorted in ascending order.
    

# `openapi_json`

```elixir
@spec openapi_json(actor_id :: String.t(), build_id :: String.t(), opts :: keyword()) ::
  {:ok, map() | nil} | {:error, ApifyClient.Error.t()}
```

Get OpenAPI definition of Actor build

Get the OpenAPI definition for Actor builds. Two similar endpoints are available:

- [Get OpenAPI definition of Actor build](https://docs.apify.com/api/v2/actor-openapi-json-get) (`/v2/actors/{actorId}/builds/{buildId}/openapi.json`): Requires both `actorId` and `buildId`. Use `default` as the `buildId` to get the OpenAPI schema for the default Actor build.

- [Get OpenAPI definition of Actor build](https://docs.apify.com/api/v2/actor-build-openapi-json-get) (`/v2/actor-builds/{buildId}/openapi.json`): Requires only `buildId`.

Get the OpenAPI definition for a specific Actor build.

To fetch the default Actor build, simply pass `default` as the `buildId`.

This endpoint doesn't require the authentication token if the Actor is public or, when you pass a build ID,
if the build's owner has [general resource access](https://docs.apify.com/account/collaboration/general-resource-access)
set to **Anyone with ID can read**. Otherwise, the token must have access to the build, or to the Actor when you
pass `default`.

:::note

You can also use the [Get OpenAPI definition of Actor build](https://docs.apify.com/api/v2/actor-build-openapi-json-get) endpoint (`/v2/actor-builds/{buildId}/openapi.json`) to get the OpenAPI definition for a build.

:::

---

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