# `Twilio.Verify.V2.Service.Entity.ChallengeService`
[🔗](https://github.com/jeffhuen/twilio_elixir/blob/main/lib/twilio/verify/v2/service/entity/challenge_service.ex#L2)

Service for Challenge API operations.

Operations: `list`, `create`, `fetch`, `update`

# `create`

```elixir
@spec create(Twilio.Client.t(), String.t(), String.t(), map(), keyword()) ::
  {:ok, Twilio.Resources.Verify.V2.Service.Entity.Challenge.t()}
  | {:ok, map(), map()}
  | :ok
  | {:error, Twilio.Error.t()}
```

Create a new Challenge for the Factor

Operation: `CreateChallenge` | Tags: VerifyV2Challenge

## Required Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `FactorSid` | string | The unique SID identifier of the Factor. |
## Optional Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
# credo:disable-for-next-line Credo.Check.Readability.MaxLineLength
| `AuthPayload` | string | Optional payload used to verify the Challenge upon creation. Only used with a Factor of type `totp` to carry the TOTP code that needs to be verified. For `TOTP` this value must be between 3 and 8 characters long. |
# credo:disable-for-next-line Credo.Check.Readability.MaxLineLength
| `Details.Fields` | array | A list of objects that describe the Fields included in the Challenge. Each object contains the label and value of the field, the label can be up to 36 characters in length and the value can be up to 128 characters in length. Used when `factor_type` is `push`. There can be up to 20 details fields. |
# credo:disable-for-next-line Credo.Check.Readability.MaxLineLength
| `Details.Message` | string | Shown to the user when the push notification arrives. Required when `factor_type` is `push`. Can be up to 256 characters in length |
# credo:disable-for-next-line Credo.Check.Readability.MaxLineLength
| `ExpirationDate` | string (date-time) | The date-time when this Challenge expires, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. The default value is five (5) minutes after Challenge creation. The max value is sixty (60) minutes after creation. |
# credo:disable-for-next-line Credo.Check.Readability.MaxLineLength
| `HiddenDetails` | string | Details provided to give context about the Challenge. Not shown to the end user. It must be a stringified JSON with only strings values eg. `{"ip": "172.168.1.234"}`. Can be up to 1024 characters in length |

# `fetch`

```elixir
@spec fetch(Twilio.Client.t(), String.t(), String.t(), String.t(), keyword()) ::
  {:ok, Twilio.Resources.Verify.V2.Service.Entity.Challenge.t()}
  | {:ok, map(), map()}
  | :ok
  | {:error, Twilio.Error.t()}
```

Fetch a specific Challenge.

Operation: `FetchChallenge` | Tags: VerifyV2Challenge

# `list`

```elixir
@spec list(Twilio.Client.t(), String.t(), String.t(), map(), keyword()) ::
  {:ok, Twilio.Page.t()}
  | {:ok, map(), map()}
  | :ok
  | {:error, Twilio.Error.t()}
```

Retrieve a list of all Challenges for a Factor.

Operation: `ListChallenge` | Tags: VerifyV2Challenge

## Query Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `FactorSid` | string | The unique SID identifier of the Factor. |
| `Status` | string | The Status of the Challenges to fetch. One of `pending`, `expired`, `approved` or `denied`. |
# credo:disable-for-next-line Credo.Check.Readability.MaxLineLength
| `Order` | string | The desired sort order of the Challenges list. One of `asc` or `desc` for ascending and descending respectively. Defaults to `asc`. |

# `stream`

```elixir
@spec stream(Twilio.Client.t(), String.t(), String.t(), map(), keyword()) ::
  Enumerable.t()
```

Stream: Retrieve a list of all Challenges for a Factor. (lazy auto-pagination).

# `update`

```elixir
@spec update(Twilio.Client.t(), String.t(), String.t(), String.t(), map(), keyword()) ::
  {:ok, Twilio.Resources.Verify.V2.Service.Entity.Challenge.t()}
  | {:ok, map(), map()}
  | :ok
  | {:error, Twilio.Error.t()}
```

Verify a specific Challenge.

Operation: `UpdateChallenge` | Tags: VerifyV2Challenge

## Optional Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
# credo:disable-for-next-line Credo.Check.Readability.MaxLineLength
| `AuthPayload` | string | The optional payload needed to verify the Challenge. E.g., a TOTP would use the numeric code. For `TOTP` this value must be between 3 and 8 characters long. For `Push` this value can be up to 5456 characters in length |
# credo:disable-for-next-line Credo.Check.Readability.MaxLineLength
| `Metadata` | string | Custom metadata associated with the challenge. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{"os": "Android"}`. Can be up to 1024 characters in length. |

---

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