# Run Actor synchronously with input and return output


```
POST 
https://api.apify.com/v2/acts/:actorId/run-sync
```


Runs a specific Actor and returns its output.

The POST payload including its `Content-Type` header is passed as `INPUT` to the Actor (usually `application/json`). The HTTP response contains Actors `OUTPUT` record from its default key-value store.

The Actor is started with the default options; you can override them using various URL query parameters. If the Actor run exceeds 300 seconds, the HTTP response will have status 408 (Request Timeout).

Beware that it might be impossible to maintain an idle HTTP connection for a long period of time, due to client timeout or network conditions. Make sure your HTTP client is configured to have a long enough connection timeout. If the connection breaks, you will not receive any information about the run and its status.

To run the Actor asynchronously, use the  API endpoint instead.

## Request

### Path Parameters

* **actorId** string required

  Actor ID or a tilde-separated owner's username and Actor name.

  **Example:** `janedoe~my-actor`

### Query Parameters

* **outputRecordKey** string

  Key of the record from run's default key-value store to be returned in the response. By default, it is `OUTPUT`.

  **Example:** `OUTPUT`

  **timeout** double

  Optional timeout for the run, in seconds. By default, the run uses the timeout from its configuration.

  **Example:** `60`

  **memory** double

  Memory limit for the run, in megabytes. The amount of memory can be set to a power of 2 with a minimum of 128. By default, the run uses the memory limit from its configuration.

  **Example:** `256`

  **maxItems** double

  Specifies the maximum number of dataset items that will be charged for pay-per-result Actors. This does NOT guarantee that the Actor will return only this many items. It only ensures you won't be charged for more than this number of items. Only works for pay-per-result Actors. Value can be accessed in the actor run using `ACTOR_MAX_PAID_DATASET_ITEMS` environment variable.

  **Example:** `1000`

  **maxTotalChargeUsd** double

  Specifies the maximum cost of the run. This parameter is useful for pay-per-event Actors, as it allows you to limit the amount charged to your subscription. You can access the maximum cost in your Actor by using the `ACTOR_MAX_TOTAL_CHARGE_USD` environment variable.

  **Example:** `5`

  **restartOnError** boolean

  Determines whether the run will be restarted if it fails.

  **Example:** `false`

  **build** string

  Specifies the Actor build to run. It can be either a build tag or build number. By default, the run uses the build from its configuration (typically `latest`).

  **Example:** `0.1.234`

  **webhooks** string

  Specifies optional webhooks associated with the Actor run, which can be used to receive a notification e.g. when the Actor finished or failed. The value is a Base64-encoded JSON array of objects defining the webhooks. For more information, see [Webhooks documentation](https://docs.apify.com/platform/integrations/webhooks).

  **Example:** `dGhpcyBpcyBqdXN0IGV4YW1wbGUK...`

### Body**required**

* **object** object

### Status 201

**Response Headers**




```
{
  "bar": "foo"
}
```


**Schema**

* **object** object

### Status 400

**Response Headers**




```
{
  "error": {
    "type": "run-failed",
    "message": "Actor run did not succeed (run ID: 55uatRrZib4xbZs, status: FAILED)"
  }
}
```


**Schema**

* **error** object

  * **type** string

    **Possible values:** \[`run-failed`]

  * **message** string\
    **Example:** `Actor run did not succeed (run ID: 55uatRrZib4xbZs, status: FAILED)`

### 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** string\
    **Example:** `Actor was not found`

### Status 408

**Response Headers**




```
{
  "error": {
    "type": "run-timeout-exceeded",
    "message": "Actor run exceeded the timeout of 300 seconds for this API endpoint"
  }
}
```


**Schema**

* **error** object

  * **type** string

    **Possible values:** \[`run-timeout-exceeded`]

  * **message** string\
    **Example:** `Actor run exceeded the timeout of 300 seconds for this API endpoint`
