Loyi API Reference
  1. Collection
Loyi API Reference
  • Getting Started
  • Architecture
  • User
    • Users Overview
    • Create user
      POST
    • Get users
      GET
    • Get user
      GET
    • Update user
      PUT
    • Delete user
      DELETE
  • Reward
    • Rewards Overview
    • Create reward
      POST
    • Get rewards
      GET
    • Delete reward
      DELETE
    • Create entry pass code
      POST
    • Get entry pass code
      GET
    • Airdrop reward
      PUT
    • Award reward
      POST
    • Redeem rewards
      GET
  • Collection
    • Collection Overview
    • Create collection
      POST
    • Get collections
      GET
    • Get collection
      GET
    • Update collection
      PUT
    • Delete collection
      DELETE
    • Get rewards
      GET
  • Collectible
    • Claim collectible
      POST
    • Get collectibles
      GET
  • Quest
    • Quest Overview
    • Create quest
    • Get quests
    • Get quest
    • Update quest
    • Delete quest
    • Get participants
    • Accept quest
    • Submit answers
    • Get answers
  • Leaderboard
    • Leaderboard Overview
    • Get leaderboard
  • Leveling
    • Get leveling configuration
    • Configure leveling
    • Get milestone levels
    • Create milestone level
    • Get milestone level
    • Update milestone level
    • Delete milestone level
  1. Collection

Create collection

Staging
https://testserver.loyi.io/public/api
Staging
https://testserver.loyi.io/public/api
POST
/collection
Collection
Creates and returns a collection.

Request

Authorization
Add parameter in header
x-api-key
Example:
x-api-key: ********************
Header Params
Origin
string 
required
The value must be one of the whitelisted domains. You can whitelist domain URLs on your Loyi dashboard.
Default:
<WHITELISTED_URL>
Example:
https://example.com
Body Params multipart/form-data
name
string 
required
Name of the collection.
description
string 
optional
Description of the collection.
type
enum<string> 
required
Type of collection.
Allowed values:
oneToOneoneToMany
amount
number 
required
Amount of collectibles
isVideo
boolean 
required
Whether or not the collection contains a video collectible
Default:
false
Example:
false
rewardIds
array[string <uuid>]
required
IDs of the rewards in the collection
image
file 
required
Image of the collection
thumbnail
file 
optional
Thumbnail image file used if isVideo is true
collectibles
file 
required
List of collectible files

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://testserver.loyi.io/public/api/collection' \
--header 'Origin;' \
--header 'x-api-key;' \
--form 'name=""' \
--form 'type=""' \
--form 'amount=""' \
--form 'isVideo="false"' \
--form 'rewardIds=""' \
--form 'image=@""' \
--form 'collectibles=@""'

Responses

🟢201Created
application/json
Created
Body
id
string <uuid>
required
publicId
string 
required
name
string 
required
Name of the collection.
description
string 
required
Description of the collection.
type
enum<string> 
required
Type of collection.
Allowed values:
oneToOneoneToMany
amount
number 
required
Amount of collectibles
image
string <uri>
required
Image of the collection
collectible
object 
required
Collectible details
imagesURL
string <uri>
required
metadataURL
string <uri>
required
contractAddress
string 
required
createdAt
string <date-time>
required
updatedAt
string <date-time>
required
Example
{
    "id": "123e4567-e89b-12d3-a456-426655440000",
    "publicId": "kdPd_ntE",
    "name": "My Collection",
    "description": "A collection of rewards",
    "image": "https://example.com/image.jpg",
    "amount": 10,
    "collectible": {
        "imagesURL": "ipfs://example",
        "metadataURL": "ipfs://example"
    },
    "type": "oneToOne",
    "contractAddress": "0x7B5DF6F27C32cEa2CeF2c4E812c0Ff4d0515B26B",
    "createdAt": "2021-01-01T00:00:00.000Z",
    "updatedAt": "2021-01-01T00:00:00.000Z"
}
🟠400Bad Request
🟠401Unauthorized
Modified at 2025-06-19 21:23:41
Previous
Collection Overview
Next
Get collections
Built with