# M Token

{% file src="<https://3021047972-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbukLaorfpwzcPSE94T%2Fuploads%2Fr5OhS4yl8NHhS9bz6mZw%2FMToken.postman_collection.json?alt=media&token=7c190ea9-870d-45c6-9881-b3abe8a92c09>" %}

### Create M Token

*Scope: Trusted*

*Request URL:*

```
POST /lorawan/create-m-token
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
    "name": "test-token"
}
```

*Response:*

```
{
    "lorawan": {
        "m_token": "525932396f6666696365407365656d656c697373612e636f6d4e455452",
        "id": "63bff8d9acf3947c56093fb4",
        "created_at": "2023-01-12 14:11:05"
    },
    "_links": {
        "self": {
            "href": "/v1/lorawan/create-m-token"
        }
    }
}
```

### Fetch All M Tokens

*Scope: Trusted*

*Request URL:*

```
GET /lorawan/fetch-m-tokens
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Response:*

```
{
    "_embedded": {
        "lorawan": [
            {
                "id": "63bd55cae6f2376c980d3952",
                "name": "test-token",
                "created_at": "2023-01-10 14:10:50",
                "_links": {
                    "self": {
                        "href": "/v1/lorawan/fetch-m-tokens"
                    }
                }
            }
        ]
    },
    "total": 1,
    "_links": {
        "self": {
            "href": "/v1/lorawan/fetch-m-tokens"
        }
    }
}
```

### Delete M token

*Scope: Trusted*

*Request URL:*

```
DELETE /lorawan/delete-m-token/{m_token id}
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Response:*

```
{
    "lorawan": {
        "id": "63bd858fe6f2376c980d3953"
    },
    "_links": {
        "self": {
            "href": "/v1/lorawan/delete-m-token/63bd858fe6f2376c980d3953"
        }
    }
}
```
