Keyavi API Documentation
Keyavi's APIs allow developers to create custom integrations with Keyavi's platform and other tools and technologies. The Keyavi API follows REST architecture. The API uses standard HTTP verbs and resource-oriented URLs, returns JSON for all requests, and responds with standard HTTP codes to indicate the success or failure of requests.
Getting Started
To get started quickly with the Keyavi APIs, review the high-level steps below and follow the instructions in the linked sections.
-
Work with your system administrator to ensure they configure API access and grant the API users appropriate privileges.
-
Get the credentials to authenticate with the Keyavi API, including the client_id, client_secret, and tenant_id.
-
Authenticate with the identity provider configured in your organization to get a Bearer token for subsequent requests.
-
Make your first call to one of the available resources.
Authentication
To access Keyavi APIs, you need to include a subscription key in the headers of your HTTP requests. The subscription key ensures secure and authorized access to the API.
To obtain a subscription key, contact your Keyavi representative. After you're issued a subscription key, you'll receive an email with everything you need.
Including Your Subscription Key in Requests
Include the subscription key (Ocp-Apim-Subscription-Key
)in the headers of your HTTP requests as follows:
curl --location 'https://<<span class="mc-variable General.Company-name variable">Keyavi</span>-API-URL>/api/endpoint' \
--header 'Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY'
Replace YOUR_SUBSCRIPTION_KEY
with the actual subscription key obtained from the developer portal.
Managing Your Subscription Key
Manage your subscription key in the Keyavi Developer Portal. There you can view your subscription keys and regenerate them if needed.
Be sure to keep your subscription key secure and never share it publicly. Treat your subscription key like a password and keep it confidential. If you suspect that your subscription key has been compromised, regenerate it in the developer portal.
-
-
curl --location 'https://login.microsoftonline.com/<Your Tenant ID>/oauth2/v2.0/token' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=<Your client ID>' \
--data-urlencode 'client_secret=<Your client secret>' \
--data-urlencode 'scope=api://<Your scope address>/.default' \
-
HTTP Requests
Keyavi APIs only accept HTTPS traffic. Requests to the Keyavi API are composed of:
-
The base URL which provides the starting point for all requests. Keyavi's base varies depending on the environment you access (e.g., production, sandbox, or UAT.) The Developer Portal is in a sandbox environment, and the base URL is
https://apimg-Keyavidev.azure-api.net/Keyavi-public/v2/api/
. -
The endpoint which represents the address of the resource you're connecting to. See the API Reference for the endpoints of each URL. The terms endpoint and resource are often used interchangeably, but in these API docs, we only use endpoint when discussing the request URL.
-
The HTTP header must always include the subscription key. All logged calls (e.g., those that create or update data) must also include the
x-api-caller-id
, which is the userid
of the person or service making the request. -
Optional query parameters which allow sorting, filtering, and limiting data. See Filtering and Sorting and Pagination for details about using query parameters.
Here's an example with the required headers for a call to the protect-remote
resource.
curl --location 'https://<<span class="mc-variable General.Company-name variable">Keyavi</span>-API-URL>/api/payloads/protect-remote/' \
--header 'x-api-caller-id: <USER-ID>' \
--header 'Ocp-Apim-Subscription-Key: <YOUR-SUBSCRIPTION-KEY>' \
Resources
A resource is an entity with associated data, relationships to other resources, and a set of methods that operate on it. For example, you can audit the Keyavi-protected files using the logs/full-payload
or logs/payload
resources.
The Keyavi APIs include the following resources:
Resource |
Description |
---|---|
Payloads are Keyavi-protected files or data. Each payload consists of the file or data and metadata about it, like who the owner is, which users aor groups can access it, and at what level they can access it. Use the |
|
users |
Users are the individuals to whom you can grant access to payloads or manage in groups. Use the |
groups |
Groups are collections of users to whom you can grant access to payloads. Use the |
logs |
Logs provide audit and forensics information. Use |
Filtering and Sorting
Keyavi resources often return large amounts of data that you can filter to produce a specific subset of records. Keyavi APIs use query parameters to filter data in requests.
Query parameters are additional parameters that you add to the API endpoint URL. You can use query parameters to filter, sort, or limit the data returned. Add query parameters to the end of the endpoint URL after a question mark ?
. This example filters log/payload
resources to show only files with Audit
actions.
curl --location 'https://<Custom API URL>/api/logs/payload?actionAttempted=Audit' \--header 'Authorization: Bearer <Your Token>'
You can add more filters by separating queries using and ampersand &
to separate parameters, like in this example:
curl --location 'https://<Custom API URL>/api/logs/payload?actionAttempted=Audit&result=RevokeAccess' \--header 'Authorization: Bearer <Your Token>'
Filter options differ for each resource. See the Parameters section for specific resources in the API Reference.
Pagination
Keyavi resources that return large amounts of data support pagination to break down large amounts of data into smaller, more manageable chunks.
Keyavi APIs implement pagination through a JSON object called pagination
. The pagination
object contains the following properties:
-
totalRecords
: The total number of records available in the dataset. -
pageSize
: The maximum number of records returned per page. -
itemsInPage
: The number of records returned on the current page. -
page
: The current page number.
You can request specific pages by passing the page number as a query parameter. This example returns page 5
from the full-payload resource.
curl --location 'https://<Custom API URL>/api/logs/full-payload?page=5' \--header 'Authorization: Bearer <Your Token>'
Users, Roles, and Permissions
Permissions define what activities an authorized user A recipient with access to the secured data file. The data owner defines the authorized users. can perform on a given endpoint. Keyavi provides predefined roles that include the permissions needed to perform certain tasks. Each user in your organization is assigned one or more roles.
Role |
Description |
Permissions |
Endpoints |
---|---|---|---|
Author |
Protect, open, and add policies to Keyavi-protected data. View limited log details. |
payload.create payload.open payload.read payload.update users.read groups.read logs.read |
POST payloads/protect-remote POST payloads/protect-local GET payloads/{payloadId} POST payloads/{payloadId}/{policy_type} GET users GET groups GET /api/logs/payload POST payloads/open-remote POST payloads/open-local |
Recipient |
Open files with their explicitly granted access level. |
payload.open |
POST payloads/open-remote POST payloads/open-local |
Security Administrator |
Audit logs |
users.read.all groups.read.all logs.read.all |
GET users GET users/?expand=true GET groups GET /api/logs/payload GET /api/logs/full-payload |
User Administrator |
Manage users and groups. |
users.read.all users.write |
GET users GET users/?expand=true POST users PATCH users/{user_id} POST users/{userId} DELETE users/{userId}/roles/{role_name} |
Data Administrator |
View and update Keyavi-protected data in the organization. |
payload.read.all payload.update.all logs.read users.read groups.read |
GET payloads/{payloadId} POST payloads/{payloadId}/{policy_type} GET /api/logs/payload GET users GET groups |
Policy Administrator |
Administers organization-level policies. |
|
|
Super Administrator |
Can perform all actions. Keyavi manages a single Super Administrator for your organization. |
All |
All |
Audit & Forensics Logs Actions, Results, and Reasons
The Paylod and Full Payload objects include attributes to describe the action taken on a file (actionAttempted
), how Keyavi responded to the action (result
), and the reason for the response (resultReason
).
Values for actionAttempted
include:
-
Encrypt
-
Decrypt
-
Audit
-
EncryptionRequest
Encrypt
Encrypt
can return the following values for result
and resultReason
.
result |
resultReason |
---|---|
AccessGranted |
|
AccessDenied |
|
Decrypt
Decrypt
can return the following values for result
and resultReason
.
result |
resultReason |
---|---|
AccessGranted |
|
AccessDenied | GeoValidationCountryExclusionFailed , TimeEmbargoFailed , UserPayloadNoAccess , or GeoValidationFailed |
Audit
Audit
can return the following values for result
and resultReason
.
result |
resultReason |
---|---|
AccessWindow | Changed or Created |
RevokeAccess |
|
AuthorisedGroupAccess |
|
AuthorisedUserAccess |
|
AuthorChanged |
|
EncryptionRequest
EncryptionRequest
can return the following values for result
and resultReason
.
result |
resultReason |
---|---|
AccessDenied | GeoValidationCountryExclusionFailed or GeoValidationFailed |