API Keys

This API is used to manage api keys under an account. Use this API to create new api key, reset an api key, delete an api key etc.

Create a new api key

Endpoint:

Method: POST
URL: https://api.agenty.com/v1/apikeys

Headers:

Key Value Description
Content-Type application/json

Query params:

Key Value Description
apikey {{API_KEY}} Your api key

Body:

{
    "name": "My backend key",
    "role_id": 4,
    "status": "active"
}

Responses:

Status: OK | Code: 200

{
    "status_code": 200,
    "message": "A new api key with id: 5073 created successfully"
}

Reset api key by id

Endpoint:

Method: GET
URL: https://api.agenty.com/v1/apikeys/{{KEY_ID}}/reset

Query params:

Key Value Description
apikey {{API_KEY}} Your api key

Responses:

Status: OK | Code: 200

{
    "status_code": 200,
    "message": "Api key with id: 5073 updated successfully"
}

Get api key by id

Endpoint:

Method: GET
URL: https://api.agenty.com/v1/apikeys/{{KEY_ID}}

Query params:

Key Value Description
apikey {{API_KEY}} Your api key

Responses:

Status: OK | Code: 200

{
    "key_id": 5071,
    "account_id": 15,
    "user_id": 38,
    "role_id": 4,
    "name": "My backend key",
    "key": "60f4e66e3db0a8670d40450190f0ac80",
    "status": "active",
    "created_at": "2019-03-08T06:31:08",
    "updated_at": null,
    "last_login_at": null,
    "is_reserved": false
}

Update api key by id

Endpoint:

Method: PUT
URL: https://api.agenty.com/v1/apikeys/{{KEY_ID}}

Headers:

Key Value Description
Content-Type application/json Your api key

Query params:

Key Value Description
apikey {{API_KEY}}

Body:

{
    "key_id": 5073,
    "name": "New name of api key",
    "role_id": 3,
    "status": "active"
}
	

Responses:

Status: OK | Code: 200

{
    "status_code": 200,
    "message": "Api key with id: 5073 updated successfully"
}

Get all api keys

Endpoint:

Method: GET
URL: https://api.agenty.com/v1/apikeys

Query params:

Key Value Description
apikey {{API_KEY}} Your api key

Responses:

Status: OK | Code: 200

{
    "total": 2,
    "limit": 1000,
    "offset": 0,
    "returned": 2,
    "result": [
        {
            "key_id": 5070,
            "name": "My Viewer key",
            "key": "some-api-key",
            "status": "active",
            "created_at": "2019-03-08T02:11:29",
            "updated_at": null,
            "last_login_at": null,
            "is_reserved": true,
            "role_id": 2,
            "role_name": "Viewer"
        },
        {
            "key_id": 5071,
            "name": "My Manager key",
            "key": "some-api-key",
            "status": "active",
            "created_at": "2019-03-08T06:31:08",
            "updated_at": null,
            "last_login_at": null,
            "is_reserved": false,
            "role_id": 4,
            "role_name": "Manager"
        }
    ]
}

Delete api key by id

Endpoint:

Method: DELETE
URL: https://api.agenty.com/v1/apikeys/{{KEY_ID}}

Query params:

Key Value Description
apikey {{API_KEY}} Your api key

Responses:

Status: OK | Code: 200

{
    "status_code": 200,
    "message": "Api key with id: 5071 deleted successfully"
}