> For the complete documentation index, see [llms.txt](https://dudaos-organization.gitbook.io/demoji-biao-qing-kai-fang-ping-tai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dudaos-organization.gitbook.io/demoji-biao-qing-kai-fang-ping-tai/api.md).

# API

### API Endpoint

&#x20;api endpoint: [https://api.demoji.xyz](https://api.demoji.xyz/)&#x20;

### Authentication

&#x20;To be determined, for the sake of speed, only some APIs will be authenticated, such as reading user information, reading pack information, etc.

&#x20;Currently, the following APIs can be used without a token:

&#x20;Authentication will be done using tokens. Users need to add the token to the Authorization field in the header in the format of Bearer \<token>. Tokens can be obtained through the login interface.

&#x20;API Endpoints&#x20;

Pack Metadata

`[GET]` `/v1/[packId]`

response type:

```typescript
interface Emoji {
    id: number;
    createdAt: string;
    index: number;
    name: string;
    packId: number;
    createdBy: string;
    icon: string;
    gif: string;
}

interface Pack {
    icon: string;
    cover: string;
    banner: string;
    creator: {
        userId: string;
        nickname: string;
        image?: string | null
    };
    emojis: Emoji[];
}
```

response example:

```json
{
  "icon": "http://localhost:3001/v1/image/0827eedd-34f8-44c8-a403-0de1c14ba46a",
  "cover": "http://localhost:3001/v1/image/75a49baf-b614-4d79-9c82-244cce966bad",
  "banner": "http://localhost:3001/v1/image/7a987703-3067-4128-9565-059488eebb93",
  "creator": {
    "userId": "64d33ec4ca25c1ecafaf0d63",
    "nickname": "Kuolomi",
    "image": "http://localhost:3001/v1/image/02cb26a9-d1f2-4837-b459-b90c2e2bd64f"
  },
  "emojis": [
    {
      "id": 25,
      "createdAt": "2023-08-09T08:33:24.936Z",
      "index": 0,
      "name": "Fuckyou",
      "packId": 2,
      "createdBy": "64d33ec4ca25c1ecafaf0d63",
      "icon": "http://localhost:3001/v1/image/e10b4993-9320-4cbd-9c72-458406501fa4",
      "gif": "http://localhost:3001/v1/image/754b32b1-8b69-4728-935b-42552dcf09e6"
    },
    {
      "id": 26,
      "createdAt": "2023-08-09T08:33:24.936Z",
      "index": 1,
      "name": "Scare the princess",
      "packId": 2,
      "createdBy": "64d33ec4ca25c1ecafaf0d63",
      "icon": "http://localhost:3001/v1/image/9bc352a3-66f9-4812-a270-b665e75d341f",
      "gif": "http://localhost:3001/v1/image/543f8873-c449-4678-be77-8ba5688e7ea0"
    },
    {
      "id": 27,
      "createdAt": "2023-08-09T08:33:24.936Z",
      "index": 2,
      "name": "Vegetable dog",
      "packId": 2,
      "createdBy": "64d33ec4ca25c1ecafaf0d63",
      "icon": "http://localhost:3001/v1/image/d9b61440-0489-45f3-8a4c-6e68be692c19",
      "gif": "http://localhost:3001/v1/image/517ca59c-de00-467c-92c2-cc4660601df4"
    },
    {
      "id": 28,
      "createdAt": "2023-08-09T08:33:24.936Z",
      "index": 3,
      "name": "55 Kiss",
      "packId": 2,
      "createdBy": "64d33ec4ca25c1ecafaf0d63",
      "icon": "http://localhost:3001/v1/image/5589a2b7-6391-4a96-bc59-7a9af951b052",
      "gif": "http://localhost:3001/v1/image/c7de7976-70dc-4a33-b767-1dd30bb1e79b"
    },
    {
      "id": 29,
      "createdAt": "2023-08-09T08:33:24.936Z",
      "index": 4,
      "name": "Help me",
      "packId": 2,
      "createdBy": "64d33ec4ca25c1ecafaf0d63",
      "icon": "http://localhost:3001/v1/image/3482f095-02ce-4929-a55a-fa9a434546a2",
      "gif": "http://localhost:3001/v1/image/33555417-b82e-4ea9-b9da-c2565b59afb4"
    },
    {
      "id": 30,
      "createdAt": "2023-08-09T08:33:24.936Z",
      "index": 5,
      "name": "Love you so much",
      "packId": 2,
      "createdBy": "64d33ec4ca25c1ecafaf0d63",
      "icon": "http://localhost:3001/v1/image/f4879ee9-c520-4752-aa8a-2e453d5a93c3",
      "gif": "http://localhost:3001/v1/image/dee361df-2081-4f09-9017-e52ffd8835cc"
    },
    {
      "id": 31,
      "createdAt": "2023-08-09T08:33:24.936Z",
      "index": 6,
      "name": "Uh uh uh",
      "packId": 2,
      "createdBy": "64d33ec4ca25c1ecafaf0d63",
      "icon": "http://localhost:3001/v1/image/7b33ec92-4301-4c18-a83f-013280f3d6fe",
      "gif": "http://localhost:3001/v1/image/a6823a8f-47be-4301-82bb-3ffc099a23ff"
    },
    {
      "id": 32,
      "createdAt": "2023-08-09T08:33:24.936Z",
      "index": 7,
      "name": "Sad",
      "packId": 2,
      "createdBy": "64d33ec4ca25c1ecafaf0d63",
      "icon": "http://localhost:3001/v1/image/17bdb279-11c8-42fd-9d26-1812c14dab8b",
      "gif": "http://localhost:3001/v1/image/90182fb2-542b-4b1e-b2ef-43a393661988"
    },
    {
      "id": 33,
      "createdAt": "2023-08-09T08:33:24.936Z",
      "index": 8,
      "name": "Go go go！",
      "packId": 2,
      "createdBy": "64d33ec4ca25c1ecafaf0d63",
      "icon": "http://localhost:3001/v1/image/add01449-17de-4a45-a239-b2912fc9bc64",
      "gif": "http://localhost:3001/v1/image/ef052fe7-51b6-4f20-a1b0-5120c617c046"
    },
    {
      "id": 34,
      "createdAt": "2023-08-09T08:33:24.936Z",
      "index": 9,
      "name": "thanks",
      "packId": 2,
      "createdBy": "64d33ec4ca25c1ecafaf0d63",
      "icon": "http://localhost:3001/v1/image/29413b5a-8865-443a-a7e0-90fff8156cc7",
      "gif": "http://localhost:3001/v1/image/670edfae-ea72-46c9-8c88-70a935e3b830"
    },
    {
      "id": 35,
      "createdAt": "2023-08-09T08:33:24.936Z",
      "index": 10,
      "name": "OK",
      "packId": 2,
      "createdBy": "64d33ec4ca25c1ecafaf0d63",
      "icon": "http://localhost:3001/v1/image/bcf07d0c-7574-46a9-9c0f-df5ccc8cb0ec",
      "gif": "http://localhost:3001/v1/image/504c28ef-902f-465e-9e07-523ef8bd7ef3"
    },
    {
      "id": 36,
      "createdAt": "2023-08-09T08:33:24.936Z",
      "index": 11,
      "name": "What",
      "packId": 2,
      "createdBy": "64d33ec4ca25c1ecafaf0d63",
      "icon": "http://localhost:3001/v1/image/f1a5d733-ba5b-4d87-ba47-ce91d7187709",
      "gif": "http://localhost:3001/v1/image/6a07fb61-7f9b-4767-bd51-9d135b779bac"
    },
    {
      "id": 37,
      "createdAt": "2023-08-09T08:33:24.936Z",
      "index": 12,
      "name": ""Thank you for your hard work",
      "packId": 2,
      "createdBy": "64d33ec4ca25c1ecafaf0d63",
      "icon": "http://localhost:3001/v1/image/d928ec3f-7a41-427b-90c0-992df8020e25",
      "gif": "http://localhost:3001/v1/image/58c0dbce-d69a-45e1-9d3d-28baf0235932"
    },
    {
      "id": 38,
      "createdAt": "2023-08-09T08:33:24.936Z",
      "index": 13,
      "name": "thanks",
      "packId": 2,
      "createdBy": "64d33ec4ca25c1ecafaf0d63",
      "icon": "http://localhost:3001/v1/image/b7e1ddc7-acd7-4f63-8d3d-0753f61184b8",
      "gif": "http://localhost:3001/v1/image/0cb6e93f-8699-423e-9599-d40cc55fb0f0"
    },
    {
      "id": 39,
      "createdAt": "2023-08-09T08:33:24.936Z",
      "index": 14,
      "name": "good night",
      "packId": 2,
      "createdBy": "64d33ec4ca25c1ecafaf0d63",
      "icon": "http://localhost:3001/v1/image/84f8c90f-4960-4cbe-9068-d986e715fa6a",
      "gif": "http://localhost:3001/v1/image/5b582b89-0959-4a73-b415-7754c3c68cb1"
    },
    {
      "id": 40,
      "createdAt": "2023-08-09T08:33:24.936Z",
      "index": 15,
      "name": "all right",
      "packId": 2,
      "createdBy": "64d33ec4ca25c1ecafaf0d63",
      "icon": "http://localhost:3001/v1/image/5f81cff2-884f-4300-a9ae-fbcdc648a95d",
      "gif": "http://localhost:3001/v1/image/8495774d-2caa-4bd6-8c54-356fde0a871a"
    }
  ],
  "id": 2,
  "createdAt": "2023-08-09T07:40:19.902Z",
  "status": "PUBLISHED",
  "name": "Demo 1”,
  "description": "Introduction to Demo 1",
  "shortDescription": "Brief Introduction to Demo 1",
  "copyright": "Copyright © Demo 1",
  "createdBy": "64d33ec4ca25c1ecafaf0d63",
  "price": "5",
  "purchasable": true
}

```

### Pack Images&#x20;

Animated GIF: /v1/\[packId]/\[emojiId] for example: /v1/1/1, returns a 240x240 GIF image&#x20;

Preview Image: /v1/\[packId]/\[emojiId]/preview for example: /v1/1/1/preview, returns a 140x140 PNG static image

### Creator Information

Creator Information:`/v1/author/[userId]` 例如：`/v1/author/64d33ec4ca25c1ecafaf0d63`

```typescript
interface Author {
    userId: string;
    nickname: string;
    image?: string | null;
}

```

```json
{
  "userId": "64d33ec4ca25c1ecafaf0d63",
  "nickname": "Er Gou",
  "image": "http://localhost:3001/v1/image/5f81cff2-884f-4300-a9ae-fbcdc648a95d"
}
```

### User's Packs

User's Packs：`/v1/user/[userId]/packs` for example：`/v1/user/64d33ec4ca25c1ecafaf0d63/packs`

```typescript
interface Emoji {
    id: number;
    createdAt: string;
    index: number;
    name: string;
    packId: number;
    createdBy: string;
    icon: string;
    gif: string;
}

interface Pack {
    icon: string;
    cover: string;
    banner: string;
    creator: {
        userId: string;
        nickname: string;
        image?: string | null
    };
    emojis: Emoji[];
}
```
