> ## 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: Sequence[Ruleset] | None=None,
                          project_id: UUID4 | None=None,
                          project_name: str | None=None,
                          stage_id: UUID4 | None=None,
                          stage_name: str | None=None,
                          stage_version: int | None=None,
                          timeout: float=TIMEOUT_SECS,
                          metadata: dict[str, str] | None=None,
                          headers: dict[str, str] | None=None) -> Response | HTTPValidationError | None
```

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: Sequence[Ruleset] | None=None,
                   project_id: UUID4 | None=None,
                   project_name: str | None=None,
                   stage_id: UUID4 | None=None,
                   stage_name: str | None=None,
                   stage_version: int | None=None,
                   timeout: float=TIMEOUT_SECS,
                   metadata: dict[str, str] | None=None,
                   headers: dict[str, str] | None=None) -> Response | HTTPValidationError | None
```

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.`:
