OTP Codes

OTPs

An OTP (One-Time Password) represents a single-use code, typically linked to a permission associated with a resource such as a phygital token, POAP event, or guestbook event.

OTP codes authenticate specific actions, and are generated through querying valid Refs. Depending on the type of the OTP, the endpoint to redeem the associated resource may vary.

The createdAt time of an OTP can also be used to validate taps server-side: the frontend can query a ref, and pass it back to the server to authenticate that the tap was performed within a valid time window. This is useful for preventing replay attacks when links from taps are shared.

Get an OTP

Fetch information for a given OTP by its ID.

Request

GET /otps/:id

Response

{
  "otp": "some-otp-code",
  "isExpired": false,
  "expiresAt": "2023-09-06T20:20:39.827Z",
  "createdAt": "2023-09-06T19:20:39.827Z",
  "type": "PHYGITAL_CLAIM",
  "linkedToken": {
    "contractAddress": "0x067f20be8e84c8fed733578e7249ea911111111",
    "chainId": 1,
    "tokenId": "1"
  }
}
FieldDescriptionType
otpThe OTP code itselfstring
isExpiredWhether the OTP code has expiredboolean
expiresAtTimestamp indicating when the OTP expiresstring
createdAtTimestamp indicating when the OTP was createdstring
typeThe type of OTP, such as "PHYGITAL_CLAIM", "POAP_EVENT", or "GUESTBOOK_EVENT"string
linkedTokenIf the OTP is linked to a Digital Twin NFT, this object provides related token informationLinkedToken?
linkedToken.contractAddressThe smart contract address for the linked tokenstring
linkedToken.chainIdThe blockchain chain ID for the linked tokennumber
linkedToken.tokenIdThe token ID for the linked tokenstring
poapEventIf the OTP is linked to a POAP event, this object provides information about the POAP eventPoapEvent?
poapEvent.idID of the linked POAP eventnumber
poapEvent.poapEventIdPOAP ID of the linked POAP eventnumber
poapEvent.statusStatus of the POAP event ("pending-approval", "future", "active", "expired", "rejected")StatusEnum
guestbookEventIf the OTP is linked to a guestbook event, this object provides information about the eventGuestbookEvent?
guestbookEvent.idID of the linked guestbook eventnumber
guestbookEvent.nameName of the linked guestbook eventstring
guestbookEvent.contractAddressThe smart contract address for the linked guestbook eventstring
guestbookEvent.chainIdThe blockchain chain ID for the linked guestbook eventnumber
guestbookEvent.tokenIdThe token ID for the linked guestbook eventstring
guestbookEvent.createdAtTimestamp indicating when the guestbook event was createdstring

Delete an OTP

Delete a given OTP by its ID. After deletion, the OTP will no longer be valid and requests to GET /otps/:id will return a 404.

Request

DELETE /otps/:id

Headers

HeaderValueRequired
x-iyk-api-keyAPI key for userYes

Response

{
  "success": true
}