> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galileo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# protect

## ainvoke\_protect

```python theme={null}
async def ainvoke_protect(payload: Payload,
                          prioritized_rulesets: Optional[Sequence[Ruleset]]=None,
                          project_id: Optional[UUID4]=None,
                          project_name: Optional[str]=None,
                          stage_id: Optional[UUID4]=None,
                          stage_name: Optional[str]=None,
                          stage_version: Optional[int]=None,
                          timeout: float=TIMEOUT_SECS,
                          metadata: Optional[dict[str, str]]=None,
                          headers: Optional[dict[str, str]]=None) -> Optional[Union[Response, HTTPValidationError]]
```

Asynchronously invoke Protect with the given payload.

If using the local stage, the prioritized rulesets should be provided to ensure the
correct rulesets are used for processing. If using a central stage, the rulesets
will be fetched from the existing stage definition.

Project ID and stage name, or stage ID should be provided for all invocations.

**Arguments**

* `payload`: Payload to be processed.
* `prioritized_rulesets`: Prioritized rulesets to be used for processing.
  These should only be provided if using a local stage. Defaults to an
  empty list if None.
* `project_id`: ID of the project.
* `project_name`: Name of the project.
* `stage_id`: ID of the stage.
* `stage_name`: Name of the stage.
* `stage_version`: Version of the stage.
* `timeout`: Timeout for the request in seconds. Defaults to TIMEOUT\_SECS.
* `metadata`: Metadata to be added when responding.
* `headers`: Headers to be added to the response.

**Returns**

* `Protect invoke results.`:

## invoke\_protect

```python theme={null}
def invoke_protect(payload: Payload,
                   prioritized_rulesets: Optional[Sequence[Ruleset]]=None,
                   project_id: Optional[UUID4]=None,
                   project_name: Optional[str]=None,
                   stage_id: Optional[UUID4]=None,
                   stage_name: Optional[str]=None,
                   stage_version: Optional[int]=None,
                   timeout: float=TIMEOUT_SECS,
                   metadata: Optional[dict[str, str]]=None,
                   headers: Optional[dict[str, str]]=None) -> Optional[Union[Response, HTTPValidationError]]
```

Invoke Protect with the given payload.

If using the local stage, the prioritized rulesets should be provided to ensure the
correct rulesets are used for processing. If using a central stage, the rulesets
will be fetched from the existing stage definition.

Project ID and stage name, or stage ID should be provided for all invocations.

**Arguments**

* `payload`: Payload to be processed.
* `prioritized_rulesets`: Prioritized rulesets to be used for processing.
  These should only be provided if using a local stage. Defaults to an
  empty list if None.
* `project_id`: ID of the project.
* `project_name`: Name of the project.
* `stage_id`: ID of the stage.
* `stage_name`: Name of the stage.
* `stage_version`: Version of the stage.
* `timeout`: Timeout for the request in seconds. Defaults to TIMEOUT\_SECS.
* `metadata`: Metadata to be added when responding.
* `headers`: Headers to be added to the response.

**Returns**

* `Protect invoke results.`:
