---
title: "Accept Challenge"
method: POST
path: "/api/challenge/accept"
---

# Accept Challenge

`POST /api/challenge/accept`

## Request

- Base URL: `https://backend.praktiki.io` (the document declares no server; this is the origin it was published from)
- URL: `https://backend.praktiki.io/api/challenge/accept`
- Auth: HTTP bearer

Accept a pending challenge with selected reward.

Changes challenge status from "pending" to "active" and sets:
- selected_reward
- reward_amount (from selected_reward)
- reward_type (derived from selected_reward.tag)
- start_timestamp = now
- end_timestamp = now + time_window_days
- accepted_timestamp = now

Args:
    request: Contains selected_reward (id, title, tag, amount)

Returns:
    Updated challenge object with status "active"

Raises:
    HTTPException: 404 if no pending challenge, 400 if invalid reward, etc.

## Request body

- AcceptChallengeRequest: Request model for accepting a challenge.
  - `selected_reward` RewardChoice, required: Reward choice model.
    - `id` integer, required
    - `title` string, required
    - `tag` string, required
    - `amount` integer, nullable
    - `type` string, nullable

## Response `200`

Successful Response

- AcceptChallengeResponse: Response model for accepting a challenge.
  - `success` boolean, required
  - `challenge` object, required
  - `message` string, nullable

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/praktiki/apis/praktiki-api.md) - [All operations](https://skmtc.dev/praktiki/apis/praktiki-api/llms.txt) - [OpenAPI document](https://skmtc.dev/praktiki/apis/praktiki-api/revisions/3428f9e0a922?raw)
