Reads the current API key used to authenticate the request. For obvious reasons, this endpoint is only available with API key authentication. However, there’s an equivalent endpoint for JWT authentication.
Access control
- Permission level
0
or higher is required to read the current API key
Endpoints
Method | Path | Authentication |
---|---|---|
GET | /whoami/key | API Key & Secret |
Response status codes
Possible status codes for these endpoints are:
Status code | Description |
---|---|
200 | success |
400 | the request was malformed |
401 | the request lacks authentication |
403 | authentication failed |
500 | server error |
NOTE
If the status code is not
200
the error
property
in the response body should indicate the nature of the problem.Response body
Value | Type | Description |
---|---|---|
result | string | success on success, and error on error |
error | string | Will give info on the nature of the error. Only set if an error occurred. |
apikey.key | string | The API key |
apikey.level | number | The privilege level of the API key |
apikey.expiresAt | string | A string representation of the moment the API key expires |
apikey.name | string | The name of the API key |
apikey.userId | number | The ID of the user who created the API key |
Example request
Javascript
const keyInfo = await axios.get(
'https://backend.freesewing.org/whoami/key',
{
auth: {
username: apikey.key,
password: apikey.secret,
}
}
)
Example response
JSON
200
{
"result": "success",
"apikey": {
"key": "7ea12968-7758-40b6-8c73-75cc99be762b",
"level": 3,
"expiresAt": "2022-11-06T15:57:30.190Z",
"name": "My first API key",
"userId": 61
}
}