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

Provides API endpoints related to api/actors/runs/last

# `abort`

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

Abort Actor's last run

Aborts the last run of the specified Actor and returns an object that
contains all the details about the run.

This endpoint is a shortcut for [Abort Actor run](https://docs.apify.com/api/v2/actor-run-abort-post)
on the Actor's last run. Only runs that are starting or running are aborted.
For runs with status `FINISHED`, `FAILED`, `ABORTING` and `TIMED-OUT` this call
does nothing.

## Options

  * `status`: Filter for the run status.
  * `origin`: Filter for the run origin, i.e. the means by which the run was started.
  * `gracefully`: If true passed, the Actor run will abort gracefully.
    It will send `aborting` and `persistState` event into run and force-stop the run after 30 seconds.
    It is helpful in cases where you plan to resurrect the run later.
    

# `get`

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

Get Actor's last run

This is not a single endpoint, but an entire group of endpoints that lets you to
retrieve and manage the last run of given Actor or any of its default storages.
All the endpoints require an authentication token.

The base path represents the last Actor run object is:

`/v2/actors/{actorId}/runs/last{?token,status,origin}`

Using the `status` query parameter you can ensure to only get a run with a certain status
(e.g. `status=SUCCEEDED`). Similarly, the `origin` query parameter filters runs by the means
by which they were started (e.g. `origin=API`). The output of this endpoint and other query
parameters are the same as in the [Get Actor run](https://docs.apify.com/api/v2/actor-run-get) endpoint.

##### Convenience endpoints for last Actor run

* [Last Actor run's default dataset](https://docs.apify.com/api/v2/last-actor-runs-default-dataset)

* [Last Actor run's default key-value store](https://docs.apify.com/api/v2/last-actor-runs-default-key-value-store)

* [Last Actor run's default request queue](https://docs.apify.com/api/v2/last-actor-runs-default-request-queue)

* [Last Actor run's log](https://docs.apify.com/api/v2/last-actor-runs-log)

## Options

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

# `log`

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

Get log of an Actor's last run

Retrieves last Actor run's logs.

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

## Options

  * `status`: Filter for the run status.
  * `origin`: Filter for the run origin, i.e. the means by which the run was started.
  * `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.
    
  * `raw`: If `true` or `1`, the logs will be kept verbatim. By default, the API removes
    ANSI escape codes from the logs, keeping only printable characters.
    

# `metamorph`

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

Metamorph Actor's last run

Transforms the last run of the specified Actor into a run of another Actor with
a new input.

This endpoint is a shortcut for [Metamorph Actor run](https://docs.apify.com/api/v2/actor-run-metamorph-post)
on the Actor's last run.

## Options

  * `status`: Filter for the run status.
  * `origin`: Filter for the run origin, i.e. the means by which the run was started.
  * `target_actor_id`: ID of a target Actor that the run should be transformed into.
  * `build`: Optional build of the target Actor.
    
    It can be either a build tag or build number. By default, the run uses
    the build specified in the default run configuration for the target
    Actor (typically `latest`).
    

# `reboot`

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

Reboot Actor's last run

Reboots the last run of the specified Actor and returns an object that
contains all the details about the rebooted run.

This endpoint is a shortcut for [Reboot Actor run](https://docs.apify.com/api/v2/actor-run-reboot-post)
on the Actor's last run. Only runs with status `RUNNING` can be rebooted. The run's
container will be restarted, so any data not persisted in the key-value store, dataset,
or request queue will be lost.

## Options

  * `status`: Filter for the run status.
  * `origin`: Filter for the run origin, i.e. the means by which the run was started.

---

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