-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change to migrate api keys reference guide to the new site. Currently using guide styling while awaiting UI input. 📖 Migrate API Reference Guides: https://www.notion.so/centrapay/Migrate-API-Reference-Guides-13d91fa1f0a443c7b1d5c64aa353151c?pvs=4 Test plan: Expect to see in dev site draft mode.
- Loading branch information
1 parent
b2923cc
commit c716280
Showing
2 changed files
with
105 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
--- | ||
title: API Keys | ||
description: Introduction to API Keys | ||
draft: true | ||
nav: | ||
path: API | ||
order: 6 | ||
--- | ||
|
||
API keys provide enduring access to a single Centrapay [Account](https://docs.centrapay.com/api/accounts). | ||
|
||
## Models | ||
|
||
### API Key | ||
|
||
#### Required Fields | ||
|
||
| Field | Type | Description | | ||
| :-------- | :------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------- | | ||
| accountId | String | The id of the Centrapay [Account](https://docs.centrapay.com/api/accounts) the API Key is scoped to. | | ||
| name | String | The alphanumeric name of the API key, must be unique within the account. | | ||
| role | String | Supported roles are: "account-owner" and "merchant-terminal". See [Auth Permissions](/api/auth#permissions) for role details. | | ||
| enabled | Boolean | Flag indicating the API Key is usable for authentication. | | ||
| createdAt | [Timestamp](/api/data-types#timestamp) | When the API Key was created. | | ||
|
||
## Operations | ||
|
||
### Create an API Key | ||
|
||
```bash [Request] | ||
curl -X POST https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/api-keys \ | ||
-H "X-Api-Key: $api_key" \ | ||
-H "Content-Type: application/json" \ | ||
-d '{ | ||
"name": "MyAPIkey", | ||
"role": "merchant-terminal" | ||
}' | ||
``` | ||
|
||
```bash [Response] | ||
{ | ||
"name": "MyAPIkey", | ||
"createdAt": "2020-06-01T22:32:56.631Z", | ||
"enabled": true, | ||
"role": "merchant-terminal", | ||
"accountId": "Jaim1Cu1Q55uooxSens6yk", | ||
"secret": "EoaEL7skkedBBy9MzrBSyxG95vUAKjYkiFvWEfiAx" | ||
} | ||
``` | ||
|
||
### List API Keys | ||
|
||
```bash [Request] | ||
curl -X GET https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/api-keys \ | ||
-H "X-Api-Key: $api_key" | ||
``` | ||
|
||
```bash [Response] | ||
[ | ||
{ | ||
"accountId": "Jaim1Cu1Q55uooxSens6yk", | ||
"name": "MyOtherAPIkey", | ||
"createdAt": "2020-06-01T21:57:25.888Z", | ||
"enabled": false, | ||
"role": "merchant-terminal" | ||
}, | ||
{ | ||
"accountId": "Jaim1Cu1Q55uooxSens6yk", | ||
"name": "MyAPIkey", | ||
"createdAt": "2020-06-01T22:34:31.308Z", | ||
"enabled": true, | ||
"role": "merchant-terminal" | ||
} | ||
] | ||
``` | ||
|
||
### Update an API Key | ||
|
||
```bash [Request] | ||
curl -X PUT https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/api-keys/MyAPIkey \ | ||
-H "X-Api-Key: $api_key" \ | ||
-H "Content-Type: application/json" \ | ||
-d '{ | ||
"enabled": false | ||
}' | ||
``` | ||
|
||
#### Required Fields | ||
|
||
| Field | Type | Description | | ||
| :------ | :------ | :--------------------- | | ||
| enabled | Boolean | Enable/Disable API key | | ||
|
||
```bash [Response] | ||
{ | ||
"accountId": "Jaim1Cu1Q55uooxSens6yk", | ||
"name": "MyAPIkey", | ||
"createdAt": "2020-06-01T22:34:31.308Z", | ||
"enabled": false, | ||
"role": "merchant-terminal" | ||
} | ||
``` |