Applications
Applications play a crucial role in facilitating systems' authentication to Basis Theory. They determine the extent of access granted to individual systems and manage Application Keys, which serve as the means for API Authentication. Each type of Application supports different use cases, and it's important to allocate access levels judiciously for each Application. Below, we provide a description of each Application Type and guidance on selecting the appropriate one for your needs
Create Application
Create a new Application for the Tenant.
Permissions
application:create
Request
- cURL
- JavaScript
- C#
- Java
- Python
- Go
curl "https://api.basistheory.com/applications" \
-H "BT-API-KEY: <MANAGEMENT_API_KEY>" \
-H "Content-Type: application/json" \
-X "POST" \
-d '{
"name": "My Example App",
"type": "private",
"permissions": [ "token:create", "token:read" ]
}'
import { BasisTheory } from "@basis-theory/basis-theory-js";
const bt = await new BasisTheory().init("<MANAGEMENT_API_KEY>");
const application = await bt.applications.create({
name: "My Example App",
type: "private",
permissions: ["token:create", "token:read"],
});
using BasisTheory.net.Applications;
var client = new ApplicationClient("<MANAGEMENT_API_KEY>");
var application = await client.CreateAsync(new Application {
Name = "My Example App",
Type = "private",
Permissions = new List<string> { "token:create", "token:read" }
});
import com.basistheory.ApiClient;
import com.basistheory.ApiException;
import com.basistheory.Configuration;
import com.basistheory.auth.*;
import com.basistheory.models.*;
import com.basistheory.ApplicationsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.basistheory.com");
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("<MANAGEMENT_API_KEY>");
ApplicationsApi apiInstance = new ApplicationsApi(defaultClient);
CreateApplicationRequest createApplicationRequest = new CreateApplicationRequest();
var application = apiInstance.create(createApplicationRequest
.name("ApplicationName123123")
.type("private")
.permissions(Arrays.asList("token:create", "token:read")));
}
}
import basistheory
from basistheory.api import applications_api
from basistheory.model.create_application_request import CreateApplicationRequest
with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="<MANAGEMENT_API_KEY>")) as api_client:
application_client = applications_api.ApplicationsApi(api_client)
application = application_client.create(create_application_request=CreateApplicationRequest(
name="My Example App",
type="private",
permissions=[ "token:create", "token:read" ]
))
package main
import (
"context"
"github.com/Basis-Theory/basistheory-go/v3"
)
func main() {
configuration := basistheory.NewConfiguration()
apiClient := basistheory.NewAPIClient(configuration)
contextWithAPIKey := context.WithValue(context.Background(), basistheory.ContextAPIKeys, map[string]basistheory.APIKey{
"ApiKey": {Key: "<MANAGEMENT_API_KEY>"},
})
createApplicationRequest := *basistheory.NewCreateApplicationRequest(applicationName, applicationType)
createApplicationRequest.SetPermissions([]string{ "token:create", "token:read" })
application, httpResponse, err := apiClient.ApplicationsApi.Create(contextWithAPIKey).CreateApplicationRequest(createApplicationRequest).Execute()
}
Request Parameters
Attribute | Required | Type | Default | Description |
---|---|---|---|---|
name | true | string | null | The name of the Application. Has a maximum length of 200 |
type | true | string | null | Application type of the application |
permissions | false | array | [] | An array of Permissions granted to the application |
rules | false | array | [] | An array of Access Rules granted to the application |
expires_at | false | string | null | ISO8601 compatible DateTime in which the application will be deleted |
create_key | false | boolean | true | When true will create an Application Key |
Either permissions
or rules
is required to be non-empty when creating an Application.
Response
Returns an Application if the application was created. Returns an error if there were validation errors, or the application failed to create.
{
"id": "fb124bba-f90d-45f0-9a59-5edca27b3b4a",
"tenant_id": "77cb0024-123e-41a8-8ff8-a3d5a0fa8a08",
"name": "My Example App",
"key": "<PRIVATE_API_KEY>",
"keys": [],
"type": "private",
"permissions": ["token:create", "token:read"],
"created_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a",
"created_at": "2020-09-15T15:53:00+00:00"
}
List Applications
Get a list of applications for the Tenant.
Permissions
application:read
Request
- cURL
- JavaScript
- C#
- Java
- Python
- Go
curl "https://api.basistheory.com/applications" \
-H "BT-API-KEY: <MANAGEMENT_API_KEY>"
import { BasisTheory } from "@basis-theory/basis-theory-js";
const bt = await new BasisTheory().init("<MANAGEMENT_API_KEY>");
const applications = await bt.applications.list();
using BasisTheory.net.Applications;
var client = new ApplicationClient("<MANAGEMENT_API_KEY>");
var applications = await client.GetAsync();
import com.basistheory.*;
import com.basistheory.auth.*;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
public class Example {
public static void main(String[] args) throws Exception {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.basistheory.com");
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("<MANAGEMENT_API_KEY>");
ApplicationsApi apiInstance = new ApplicationsApi(defaultClient);
List<UUID> id = Arrays.asList();
List<String> type = Arrays.asList();
Integer page = 1;
Integer size = 38;
ApplicationPaginatedList result = apiInstance.get(id, type, page, size);
}
import basistheory
from basistheory.api import applications_api
with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="<MANAGEMENT_API_KEY>")) as api_client:
application_client = applications_api.ApplicationsApi(api_client)
applications = application_client.get()
package main
import (
"context"
"github.com/Basis-Theory/basistheory-go/v3"
)
func main() {
configuration := basistheory.NewConfiguration()
apiClient := basistheory.NewAPIClient(configuration)
contextWithAPIKey := context.WithValue(context.Background(), basistheory.ContextAPIKeys, map[string]basistheory.APIKey{
"ApiKey": {Key: "<MANAGEMENT_API_KEY>"},
})
applications, httpResponse, err := apiClient.ApplicationsApi.Get(contextWithAPIKey).Execute()
}
Query Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
id | false | array | [] | An optional list of application IDs to filter the list of applications by |
Response
Returns a paginated object with the data
property containing an array of applications. Providing any query parameters will filter the results. Returns an error if applications could not be retrieved.
{
"pagination": {...}
"data": [
{
"id": "fb124bba-f90d-45f0-9a59-5edca27b3b4a",
"tenant_id": "77cb0024-123e-41a8-8ff8-a3d5a0fa8a08",
"name": "My Example App",
"keys": [],
"type": "private",
"permissions": [
"token:create",
"token:read"
],
"created_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a",
"created_at": "2020-09-15T15:53:00+00:00",
"modified_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a",
"modified_at": "2021-03-01T08:23:14+00:00"
},
{...},
{...}
]
}
Get an Application
Get an application by ID in the Tenant.
Permissions
application:read
Request
- cURL
- JavaScript
- C#
- Java
- Python
- Go
curl "https://api.basistheory.com/applications/fe1f9ba4-474e-44b9-b949-110cdba9d662" \
-H "BT-API-KEY: <MANAGEMENT_API_KEY>"
import { BasisTheory } from "@basis-theory/basis-theory-js";
const bt = await new BasisTheory().init("<MANAGEMENT_API_KEY>");
const application = await bt.applications.retrieve(
"fe1f9ba4-474e-44b9-b949-110cdba9d662"
);
using BasisTheory.net.Applications;
var client = new ApplicationClient("<MANAGEMENT_API_KEY>");
var application = await client.GetByIdAsync("fe1f9ba4-474e-44b9-b949-110cdba9d662");
import com.basistheory.*;
import com.basistheory.auth.*;
public class Example {
public static void main(String[] args) throws Exception {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.basistheory.com");
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("<MANAGEMENT_API_KEY>");
ApplicationsApi apiInstance = new ApplicationsApi(defaultClient);
Application result = apiInstance.getById("9b806250-d507-46e7-9dc0-de0f89a91a92");
}
}
import basistheory
from basistheory.api import applications_api
with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="<MANAGEMENT_API_KEY>")) as api_client:
application_client = applications_api.ApplicationsApi(api_client)
application = application_client.get_by_id("fe1f9ba4-474e-44b9-b949-110cdba9d662")
package main
import (
"context"
"github.com/Basis-Theory/basistheory-go/v3"
)
func main() {
configuration := basistheory.NewConfiguration()
apiClient := basistheory.NewAPIClient(configuration)
contextWithAPIKey := context.WithValue(context.Background(), basistheory.ContextAPIKeys, map[string]basistheory.APIKey{
"ApiKey": {Key: "<MANAGEMENT_API_KEY>"},
})
application, httpResponse, err := apiClient.ApplicationsApi.GetById(contextWithAPIKey, "fe1f9ba4-474e-44b9-b949-110cdba9d662").Execute()
}
URI Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
id | true | uuid | null | The ID of the application |
Response
Returns an Application with the id
provided. Returns an error if the application could not be retrieved.
{
"id": "fe1f9ba4-474e-44b9-b949-110cdba9d662",
"tenant_id": "77cb0024-123e-41a8-8ff8-a3d5a0fa8a08",
"name": "My Management App",
"keys": [],
"type": "management",
"permissions": ["application:create", "application:read"],
"created_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a",
"created_at": "2020-09-15T15:53:00+00:00",
"modified_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a",
"modified_at": "2021-03-01T08:23:14+00:00"
}
Get an Application by Key
Get an application by key in the Tenant. Will use the BT-API-KEY
header to lookup the application.
Permissions
application:read
Request
- cURL
- JavaScript
- C#
- Java
- Python
- Go
curl "https://api.basistheory.com/applications/key" \
-H "BT-API-KEY: <MANAGEMENT_API_KEY>"
import { BasisTheory } from "@basis-theory/basis-theory-js";
const bt = await new BasisTheory().init("<MANAGEMENT_API_KEY>");
const application = await bt.applications.retrieveByKey();
using BasisTheory.net.Applications;
var client = new ApplicationClient("<MANAGEMENT_API_KEY>");
var application = await client.GetByKeyAsync();
import com.basistheory.*;
import com.basistheory.auth.*;
public class Example {
public static void main(String[] args) throws Exception {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.basistheory.com");
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("<MANAGEMENT_API_KEY>");
ApplicationsApi apiInstance = new ApplicationsApi(defaultClient);
Application result = apiInstance.getByKey();
}
}
import basistheory
from basistheory.api import applications_api
with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="<MANAGEMENT_API_KEY>")) as api_client:
application_client = applications_api.ApplicationsApi(api_client)
application = application_client.get_by_key()
package main
import (
"context"
"github.com/Basis-Theory/basistheory-go/v3"
)
func main() {
configuration := basistheory.NewConfiguration()
apiClient := basistheory.NewAPIClient(configuration)
contextWithAPIKey := context.WithValue(context.Background(), basistheory.ContextAPIKeys, map[string]basistheory.APIKey{
"ApiKey": {Key: "<MANAGEMENT_API_KEY>"},
})
application, httpResponse, err := apiClient.ApplicationsApi.GetByKey(contextWithCreatedAppAPIKey).Execute()
}
Response
Returns an Application for the provided BT-API-KEY
. Returns an error if the application could not be retrieved.
{
"id": "fe1f9ba4-474e-44b9-b949-110cdba9d662",
"tenant_id": "77cb0024-123e-41a8-8ff8-a3d5a0fa8a08",
"name": "My Management App",
"keys": [],
"type": "management",
"permissions": ["application:create", "application:read"],
"created_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a",
"created_at": "2020-09-15T15:53:00+00:00",
"modified_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a",
"modified_at": "2021-03-01T08:23:14+00:00"
}
Update Application
Update an application by ID in the Tenant.
Permissions
application:update
Request
- cURL
- JavaScript
- C#
- Java
- Python
- Go
curl "https://api.basistheory.com/applications/fb124bba-f90d-45f0-9a59-5edca27b3b4a" \
-H "BT-API-KEY: <MANAGEMENT_API_KEY>" \
-H "Content-Type: application/json"
-X "PUT" \
-d '{
"name": "My Example App",
"permissions": [
"application:create",
"application:read"
]
}'
import { BasisTheory } from "@basis-theory/basis-theory-js";
const bt = await new BasisTheory().init("<MANAGEMENT_API_KEY>");
const application = await bt.applications.update(
"fb124bba-f90d-45f0-9a59-5edca27b3b4a",
{
name: "My Example App",
permissions: ["application:create", "application:read"],
}
);
using BasisTheory.net.Applications;
var client = new ApplicationClient("<MANAGEMENT_API_KEY>");
var application = await client.UpdateAsync("fb124bba-f90d-45f0-9a59-5edca27b3b4a",
new Application {
Name = "My Example App",
Permissions = new List<string> { "application:create", "application:read" }
}
);
import com.basistheory.*;
import com.basistheory.auth.*;
import java.util.Arrays;
import java.util.UUID;
public class Example {
public static void main(String[] args) throws Exception {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.basistheory.com");
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("<MANAGEMENT_API_KEY>");
ApplicationsApi apiInstance = new ApplicationsApi(defaultClient);
UpdateApplicationRequest updateApplicationRequest = new UpdateApplicationRequest();
Application application = apiInstance.update("f7c90548-ea08-4757-bb2d-a5cfe3fb4782", updateApplicationRequest
.name("ApplicationName")
.permissions(Arrays.asList("token:create")));
}
}
import basistheory
from basistheory.api import applications_api
from basistheory.model.update_application_request import UpdateApplicationRequest
with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="<MANAGEMENT_API_KEY>")) as api_client:
application_client = applications_api.ApplicationsApi(api_client)
application = application_client.update("fb124bba-f90d-45f0-9a59-5edca27b3b4a", update_application_request=UpdateApplicationRequest(
name="My Example App",
permissions=[ "application:create", "application:read" ]
))
package main
import (
"context"
"github.com/Basis-Theory/basistheory-go/v3"
)
func main() {
configuration := basistheory.NewConfiguration()
apiClient := basistheory.NewAPIClient(configuration)
contextWithAPIKey := context.WithValue(context.Background(), basistheory.ContextAPIKeys, map[string]basistheory.APIKey{
"ApiKey": {Key: "<MANAGEMENT_API_KEY>"},
})
updateApplicationRequest := basistheory.NewUpdateApplicationRequest(updatedApplicationName)
updateApplicationRequest.SetPermissions([]string{ "application:create", "application:read" })
application, httpResponse, err := apiClient.ApplicationsApi.Update(contextWithAPIKey, "fb124bba-f90d-45f0-9a59-5edca27b3b4a").UpdateApplicationRequest(updateApplicationRequest).Execute()
}
URI Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
id | true | uuid | null | The ID of the application |