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

Provides API endpoints related to api/builds

# `abort_200_json_resp`

```elixir
@type abort_200_json_resp() :: %{data: ApifyClient.Schemas.Build.t() | nil}
```

# `get_200_json_resp`

```elixir
@type get_200_json_resp() :: %{data: ApifyClient.Schemas.Build.t() | nil}
```

# `abort`

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

Abort Actor build

Aborts an Actor build and returns an object that contains all the details
about the build.

Only builds that are starting or running are aborted. For builds with status
`FINISHED`, `FAILED`, `ABORTING` and `TIMED-OUT` this call does nothing.

# `delete`

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

Delete Actor build

Delete the build. The build that is the current default build for the Actor
cannot be deleted.

Only users with build permissions for the Actor can delete builds.

# `get`

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

Get Actor build

Gets an object that contains all the details about a specific build of an
Actor.

By passing the optional `waitForFinish` parameter the API endpoint will
synchronously wait for the build to finish. This is useful to avoid periodic
polling when waiting for an Actor build to finish.

This endpoint does not require the authentication token. Instead, calls are authenticated using a hard-to-guess ID of the build. However,
if you access the endpoint without the token, certain attributes, such as `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(opts :: keyword()) ::
  {:ok, ApifyClient.Schemas.ListOfBuilds.t()} | {:error, ApifyClient.Error.t()}
```

Get list of user's Actor builds

Gets a list of all builds for a user. The response is a JSON array 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.
    

# `log`

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

Get Actor build's log

Retrieves Actor build's logs.

This endpoint is a shortcut for getting the build's log. Same as [Get Actor build or run log](https://docs.apify.com/api/v2/log-get) endpoint.

## Options

  * `stream`: If `true` or `1` then the logs will be streamed as long as the run or build is running.
    
  * `download`: If `true` or `1` then the web browser will download the log file rather than open it in a tab.
    

# `openapi_json`

```elixir
@spec openapi_json(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.

This endpoint doesn't require the authentication token if the Actor is public or 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.

:::note

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

:::

---

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