unPLUGDevelopers

Challenges API

Join a challenge Coming soon

POST/v1/members/me/challenges/{id}/join

Enrolls the member in an opt_in challenge. Returns the member challenge with status: "enrolled". For a rolling challenge, the member's window starts now. Joining a challenge the member is already in returns their current state, so a retry after a timeout is safe.

Permissions: Member token.

Request headers#

  • Idempotency-Keystring
    Any string up to 255 characters; use a UUID v4. Kept 24 hours per key (or member) and endpoint. Same key and body replays the first response with Idempotent-Replayed: true.
    Max Length 255

Path parameters#

  • idstring (uuid)Required
    The challenge.

Response fields#

Returns 200 with MemberChallenge

  • challenge_idstring (uuid)
    The challenge.
  • member_idstring (uuid)
  • statusstring
    eligible (can join, not joined), enrolled, completed or expired.
    One of eligible, enrolled, completed, expired
  • progressobject
    current, target and unit. For streaks, periods lists each day or week with starts_at, ends_at and met; it's empty for other types.
    Show attributesHide attributes
    • currentinteger
    • targetinteger
    • unitstring
      One of visits, periods, cents, items
    • periodsarray of object
      Show attributesHide attributes
      • starts_atstring (date-time)
      • ends_atstring (date-time)
      • metboolean
  • window_ends_atstring (date-time)Nullable
    When this member's window ends. For a rolling challenge they haven't joined, null.
  • completed_atstring (date-time)Nullable
    When they completed it, or null.
  • reward_wallet_item_idstring (uuid)Nullable
    The wallet item paid on completion, for catalog rewards. null otherwise.

Error descriptions#

422Unprocessable
challenge_not_joinable

The challenge is automatic, isn't live, has used its budget, or isn't open to this member. detail says which.

404Not found
not_found

No such challenge.

Any endpoint can also return the common errors.