# API Reference

Authentication

In order to use the Giftcard API users must authenticate using a bearer to access the endpoints. Bearer tokens can be obtained within the Admin Area -> API Keys -> Create (on your application).

Bearer tokens can only be created and used by root administrators (users that have the admin.root permission).&#x20;

Bearer tokens can be specified inside the `Authorization` header in your request.&#x20;

| Header          | Value                        |
| --------------- | ---------------------------- |
| `Authorization` | `Bearer <your_access_token>` |

```sh
curl -H "Authorization: Bearer <your_access_token>" https://wemx.app/giftcard/api/v1/test
```

Replace `<your_access_token>` with your Bearer token.

{% hint style="warning" %}
API Keys should not be shared with anyone or stored in places that are easily compromisable such as chats, emails and/or hardcoding them into your code.
{% endhint %}

<details>

<summary><img src="https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2F5lTiGZU6vuAvgWqjMpqA%2Fbrave_8vziW58N9R.png?alt=media&#x26;token=05ad0e34-01a2-4426-b009-099bb795c0de" alt="" data-size="original">   https://wemx.app/giftcards/api/v1/test <br>Try if the Giftcard API workes<br><br>Returns if the giftcard API is working<br><br><img src="https://cdn.gamestacks.de/go/8m9vGY" alt=""><br></summary>

![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FL0jsrCd9MILTJfxRryYa%2Fbrave_fv44LDO0wf.png?alt=media\&token=84b0bf4c-d045-4550-89c2-ceb2c27726b4)

![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FmAC6gJSKswUDClWYvq0U%2Fbrave_10aRNsG0BK.png?alt=media\&token=95de9b08-8c5b-405d-a7f5-77fa3211eb21)            &#x20;

```sh
{
	"success": true,
	"message": "Gift card API is working"
}
```

&#x20;                                                                                                                         &#x20;

</details>

<details>

<summary><img src="https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2F282TYC3RTn6IaqFOMK59%2Fbrave_Sw0hjDWf0h.png?alt=media&#x26;token=b2451a22-5028-46fe-9909-1592bfc31f11" alt="" data-size="original">   https://wemx.app/giftcards/api/v1/create<br>Create a Giftcard</summary>

Create a Giftcard with given Values

![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FhQlP1zkY4HCAHXm9B83g%2Fbrave_UNDbpyw361.png?alt=media\&token=60a0028a-20fa-4c0d-a57a-f0f4c1e9d6cc)\
\
giftcard\_value<mark style="color:red;">**\***</mark>        Numeric                   Value of the Giftcard\
![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FeSFWoJYNJICRyqRJpov1%2Fbrave_0RMsF779xx.png?alt=media\&token=c4e85311-5b12-4a2d-b31e-32b8d01a4257)![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FeSFWoJYNJICRyqRJpov1%2Fbrave_0RMsF779xx.png?alt=media\&token=c4e85311-5b12-4a2d-b31e-32b8d01a4257)\
giftcard\_status        active/inactive       Status of the Giftcard\
![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FeSFWoJYNJICRyqRJpov1%2Fbrave_0RMsF779xx.png?alt=media\&token=c4e85311-5b12-4a2d-b31e-32b8d01a4257)![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FeSFWoJYNJICRyqRJpov1%2Fbrave_0RMsF779xx.png?alt=media\&token=c4e85311-5b12-4a2d-b31e-32b8d01a4257)\
buyer\_id                    Numeric                   Buyer UserID for gift card management![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FeSFWoJYNJICRyqRJpov1%2Fbrave_0RMsF779xx.png?alt=media\&token=c4e85311-5b12-4a2d-b31e-32b8d01a4257)![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FeSFWoJYNJICRyqRJpov1%2Fbrave_0RMsF779xx.png?alt=media\&token=c4e85311-5b12-4a2d-b31e-32b8d01a4257)\
\
![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FG5KXQHRnTbdZuRhA8VXG%2Fbrave_fv44LDO0wf.png?alt=media\&token=9527f084-c2f4-41f2-b325-12c17aae8796)

![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FqWKGOyYom8SiTHA0Rb2c%2Fbrave_10aRNsG0BK.png?alt=media\&token=88bfb4de-e5c5-4886-8563-899ff75c0317)

```shell
{
	"success": true,
	"data": {
		"giftcard_code": "4GOSL-OL933-X6BH8-LODV",
		"giftcard_value": "10",
		"giftcard_status": "active",
		"buyer_id": "1",
		"updated_at": "2024-02-27T16:58:25.000000Z",
		"created_at": "2024-02-27T16:58:25.000000Z",
		"id": 16
	}
}
```

</details>

<details>

<summary><img src="https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FkWp8LeP3CCRiSy393HIf%2Fbrave_8vziW58N9R.png?alt=media&#x26;token=e14b6de7-94a0-44d7-802c-63df86b3921a" alt="" data-size="original">   https://wemx.app/giftcards/api/v1/gencode<br>Create a nice looking code</summary>

Creates a nice looking code if you want to use a extenal thing to gen codes

![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FOyFSYrqU3xDfRs92a5rY%2Fbrave_Fz02496m9A.png?alt=media\&token=4b3a6e45-1888-4d89-aa84-37ddff539c3f)

![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FpCwhUPF5qphS9ACaVuFC%2Fbrave_fv44LDO0wf.png?alt=media\&token=10b98211-3f90-401e-9c74-169fd872362a)

![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FiHhTKFvcs8VFegvbbbiB%2Fbrave_10aRNsG0BK.png?alt=media\&token=4f1f9bd6-d086-48b9-a04a-3e1546e82c61)

```shell
{
	"success": true,
	"code": "TXO18-KS6VH-IKFH4-2580"
}
```

</details>

<details>

<summary><img src="https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FJGBpVItDgRaUUIlqEsUA%2Fbrave_Sw0hjDWf0h.png?alt=media&#x26;token=0d9ae185-8354-4547-8f20-dd53d2ad1752" alt="" data-size="original">   https://wemx.app/giftcards/api/v1/validate<br>Validates a Giftcard code</summary>

Returns a if the Giftcard is valid or invalid

![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2Fxg9BQ5llIxl2uBvIARuQ%2Fbrave_UNDbpyw361.png?alt=media\&token=c77d63ca-19be-41dc-9284-b920f34894ed)

giftcard\_code<mark style="color:red;">**\***</mark>       String       Giftcardcode\
![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2Fhas4KRnK8pWGvrracDE1%2Fbrave_0RMsF779xx.png?alt=media\&token=8a48c7ef-b6d2-49d5-b3df-662b7d94ca54)

![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2Fyj0zMc0rFnlCXvrfuwZw%2Fbrave_fv44LDO0wf.png?alt=media\&token=7242cf83-c0cf-4ec3-8dbd-c34952f82a50)

![](https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FkFx6hhu7k7Bs3HSVJAET%2Fbrave_10aRNsG0BK.png?alt=media\&token=61c1e961-7dab-472a-8888-67c0f9e68de1)

```shell
{
	"success": true,
	"message": "Gift card is valid",
	"valid": true
}
```

</details>

That is everything that comes with API version 1 if you want that new stuff is added to the API and a new Version of the API will be developed then create a Feature request at our Github to get it added.
