---
sourceType: api-reference
sourceTypeMatchedRule: openApis
slug: MA/openApis/partner/apis/qrCodeShortLink
title: Tạo short link QR code
---
Được sử dụng tạo các đường dẫn ngắn cho deeplink của Mini App kèm theo các query param mà bạn muốn truyền vào.

## 1. Tạo Short Link QR Code

### Parameters

| Property  | Type   | Required | Description                                                                                                                                                                                                 |
| --------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| miniAppId | long   | true     | ID của Mini App tương ứng                                                                                                                                                                                   |
| originUrl | String | true     | Deeplink của Mini App phải bắt đầu bằng `https://zalo.me/s/`, có thể kèm theo `/sub-path` và buộc phải chứa `utm_source=zalo-qr`. Bạn cũng có thể thêm bất kỳ query param nào khác theo nhu cầu. |

### Return Values

| Property | Type   | Description                                              |
| -------- | ------ | -------------------------------------------------------- |
| error    | int    | Mã lỗi của kết quả trả về, bằng 0 nếu request thành công |
| message  | String | Lời nhắn chi tiết tương ứng với mã lỗi                   |
| shortUrl | String | Deeplink đã được làm ngắn tương ứng với Deeplink ban đầu |

#### Sample Code


### Code sample — Java

```js
import com.vng.zalo.miniapp.openapi.sdk.models.CreateQRCodeShortUrlRequest;
import com.vng.zalo.miniapp.openapi.sdk.models.CreateQRCodeShortUrlResponse;

CreateQRCodeShortUrlRequest request = new CreateQRCodeShortUrlRequest();
request.setMiniAppId({Your Mini App's Id});
request.setOriginUrl("https://zalo.me/s/<your-miniapp-id>/<option-sub-path>/?utm_source=zalo-qr&any_param_here=any_value_here");

CreateQRCodeShortUrlResponse qrCodeShortUrl = client.createQRCodeShortUrl(request);
```

### Code sample — Node.js

```js
import {
  CreateQRCodeShortUrlRequest,
  CreateQRCodeShortUrlResponse,
} from "zmp-openapi-nodejs";

async function createQrCodeShortLink() {
  const createQrCodeRequest: CreateQRCodeShortUrlRequest = {
    miniAppId: process.env.MINI_APP_ID || "",
    originUrl: `https://zalo.me/s/${process.env.MINI_APP_ID}/?utm_source=zalo-qr&utm_medium=qr_code&utm_campaign=qr_code_short_link`,
  };

  const response: CreateQRCodeShortUrlResponse =
    await client.createQrCodeShortUrl(createQrCodeRequest);
  console.log(response);
}
```

## 2. Lấy danh sách QR Code Short Link

### Parameters

| Property  | Type | Required | Description               |
| --------- | ---- | -------- | ------------------------- |
| miniAppId | long | true     | ID của Mini App tương ứng |
| offset    | int  | true     | Vị trí bắt đầu            |
| limit     | int  | true     | Số lượng cần lấy          |

### Return Values

| Property   | Type                 | Description                                              |
| ---------- | -------------------- | -------------------------------------------------------- |
| error      | int                  | Mã lỗi của kết quả trả về, bằng 0 nếu request thành công |
| message    | String               | Lời nhắn chi tiết tương ứng với mã lỗi                   |
| total      | int                  | Tổng số toàn bộ version của Mini App                     |
| shortLinks | List QRCodeShortLink | Danh sách các QRCodeShortLink                            |

### QRCodeShortLink

| Property  | Type   | Description                                              |
| --------- | ------ | -------------------------------------------------------- |
| shortUrl  | String | Deeplink đã được làm ngắn tương ứng với Deeplink ban đầu |
| originUrl | String | Deeplink của Mini App                                    |
| status    | Enum   | ACTIVE, INACTIVE                                         |

#### Sample Code

### Code sample — Java

```js
import com.vng.zalo.miniapp.openapi.sdk.models.ListQRCodeShortLinkRequest;
import com.vng.zalo.miniapp.openapi.sdk.models.ListQRCodeShortLinkResponse;

ListQRCodeShortLinkRequest listQRCodeShortLinkRequest = new ListQRCodeShortLinkRequest({Your Mini App's Id}, 0, 10);
ListQRCodeShortLinkResponse listQRCodeShortLinkResponse = client.listQRCodeShortLink(listQRCodeShortLinkRequest);
```

### Code sample — Node.js

```js
import {
  ListQRCodeShortLinkRequest,
  ListQRCodeShortLinkResponse,
} from "zmp-openapi-nodejs";

async function listQrCodeShortLinks() {
  const listQrCodeRequest: ListQRCodeShortLinkRequest = {
    miniAppId: process.env.MINI_APP_ID || "",
    limit: 20,
    offset: 0,
  };

  const response: ListQRCodeShortLinkResponse =
    await client.listQrCodeShortLinks(listQrCodeRequest);
  console.log(response);
}
```
