List Access Passes
Retrieve a paginated list of Access Passes. Optionally provide a template_id to list passes for a specific card template, or omit it to list all passes across all templates in your account. You can also filter by current state and metadata.
template_id
nullable string
Optional. The card template ID to list keys for. If omitted, returns keys for all templates in the account.
state
nullable string
Filter keys by state (active, suspended, unlink, deleted)
metadata
nullable object
Filter keys by metadata key/value pairs (maximum of 2 key/value pairs). Example: metadata[department]=engineering&metadata[floor]=3
page
nullable integer
Page number for pagination (default: 1)
per_page
nullable integer
Number of results per page (default: 25, max: 100)
Request
# Prepare for GET request
# Create a payload with the template ID
TEMPLATE_ID="0xd3adb00b5"
PAYLOAD='{"id":"$TEMPLATE_ID"}'
PAYLOAD_B64=$(echo -n $PAYLOAD | base64)
HASH=$(echo -n "$SHARED_SECRET$PAYLOAD_B64" | openssl sha256 | awk '{print $2}')
# Send curl request
curl -v \
-X GET \
-H 'X-ACCT-ID: 123' \
-H "X-PAYLOAD-SIG: $HASH" \
"https://api.accessgrid.com/v1/key-cards?template_id=$TEMPLATE_ID&sig_payload=" + urlencode($PAYLOAD)
require('accessgrid')
acct_id = ENV['ACCOUNT_ID']
secret_key = ENV['SECRET_KEY']
client = AccessGrid.new(acct_id, secret_key)
# Get filtered keys by template
keys = client.access_cards.list(template_id: "0xd3adb00b5")
# Get filtered keys by state
keys = client.access_cards.list(state: "active")
# Print keys
keys.each do |key|
puts "Key ID: #{key.id}, Name: #{key.full_name}, State: #{key.state}"
end
import AccessGrid from 'accessgrid';
const accountId = process.env.ACCOUNT_ID;
const secretKey = process.env.SECRET_KEY;
const client = new AccessGrid(accountId, secretKey);
const listKeys = async () => {
try {
// Get filtered keys by template
const templateKeys = await client.accessCards.list({ templateId: "0xd3adb00b5" });
// Get filtered keys by state
const activeKeys = await client.accessCards.list({ state: "active" });
// Print keys
allKeys.forEach(key => {
console.log(`Key ID: ${key.id}, Name: ${key.fullName}, State: ${key.state}`);
});
} catch (error) {
console.error('Error listing Access Passes:', error);
}
};
listKeys();
from accessgrid import AccessGrid
import os
account_id = os.getenv('ACCOUNT_ID')
secret_key = os.getenv('SECRET_KEY')
client = AccessGrid(account_id, secret_key)
# Get filtered keys by template
template_keys = client.access_cards.list(template_id="0xd3adb00b5")
# Get filtered keys by state
active_keys = client.access_cards.list(state="active")
# Print keys
for key in active_keys:
print(f"Key ID: {key.id}, Name: {key.full_name}, State: {key.state}")
package main
import (
"context"
"fmt"
"os"
"github.com/Access-Grid/accessgrid-go"
)
func main() {
accountID := os.Getenv("ACCOUNT_ID")
secretKey := os.Getenv("SECRET_KEY")
client, err := accessgrid.NewClient(accountID, secretKey)
if err != nil {
fmt.Printf("Error creating client: %v\n", err)
return
}
ctx := context.Background()
// Get filtered keys by template
templateFilter := accessgrid.ListKeysParams{
TemplateID: "0xd3adb00b5",
}
templateKeys, err := client.AccessCards.List(ctx, &templateFilter)
if err != nil {
fmt.Printf("Error listing cards: %v\n", err)
return
}
// Get filtered keys by state
stateFilter := accessgrid.ListKeysParams{
State: "active",
}
activeKeys, err := client.AccessCards.List(ctx, &stateFilter)
if err != nil {
fmt.Printf("Error listing cards: %v\n", err)
return
}
// Print keys
for _, key := range templateKeys {
fmt.Printf("Key ID: %s, Name: %s, State: %s\n", key.ID, key.FullName, key.State)
}
}
using AccessGrid;
using System;
using System.Threading.Tasks;
public async Task ListCardsAsync()
{
var accountId = Environment.GetEnvironmentVariable("ACCOUNT_ID");
var secretKey = Environment.GetEnvironmentVariable("SECRET_KEY");
var client = new AccessGridClient(accountId, secretKey);
// Get filtered keys by template
var templateKeys = await client.AccessCards.ListAsync(new ListKeysRequest
{
TemplateId = "0xd3adb00b5"
});
// Get filtered keys by state
var activeKeys = await client.AccessCards.ListAsync(new ListKeysRequest
{
State = "active"
});
// Print keys
foreach (var key in allKeys)
{
Console.WriteLine($"Key ID: {key.Id}, Name: {key.FullName}, State: {key.State}");
}
}
public class ListKeysRequest
{
public string TemplateId { get; set; }
public string State { get; set; }
}
import com.organization.accessgrid.AccessGridClient;
import com.organization.accessgrid.model.Card;
import com.organization.accessgrid.model.ListKeysParams;
import java.util.List;
public class AccessCardService {
private final AccessGridClient client;
public AccessCardService() {
String accountId = System.getenv("ACCOUNT_ID");
String secretKey = System.getenv("SECRET_KEY");
this.client = new AccessGridClient(accountId, secretKey);
}
public void listCards() throws AccessGridException {
// Get filtered keys by template
ListKeysParams templateFilter = ListKeysParams.builder()
.templateId("0xd3adb00b5")
.build();
List<Card> templateKeys = client.accessCards().list(templateFilter);
// Get filtered keys by state
ListKeysParams stateFilter = ListKeysParams.builder()
.state("active")
.build();
List<Card> activeKeys = client.accessCards().list(stateFilter);
// Print keys
for (Card key : allKeys) {
System.out.printf("Key ID: %s, Name: %s, State: %s%n",
key.getId(),
key.getFullName(),
key.getState());
}
}
}
Response
{
"status": "success",
"count": 2,
"total_count": 2,
"page": 1,
"per_page": 20,
"total_pages": 1,
"keys": [
{
"id": "key_9f3a12bc",
"full_name": "John Doe",
"employee_id": "EMP-10234",
"state": "active",
"install_url": "https://install.accessgrid.io/pass/key_9f3a12bc",
"card_template_id": "0xd3adb00b5",
"expiration_date": "2026-03-31T23:59:59Z",
"created_at": "2025-01-15T10:22:11Z",
"metadata": {
"department": "Engineering",
"location": "HQ"
},
"card_number": "4920-8833-1122",
"site_code": "NYC-HQ",
"direct_install_url": "https://pay.google.com/gp/v/save/abcdef123456"
},
{
"id": "key_b81d77ef",
"full_name": "Jane Smith",
"employee_id": "EMP-10891",
"state": "inactive",
"install_url": "https://install.accessgrid.io/pass/key_b81d77ef",
"card_template_id": "0xhotel98765",
"expiration_date": "2025-12-31T23:59:59Z",
"created_at": "2024-11-03T08:45:00Z",
"metadata": {
"department": "Operations",
"role": "Manager"
},
"file_data": {
"file_name": "hotel_pass.pkpass",
"file_size": 24576
},
"is_pass_ready_to_transact": true
}
]
}
Issue Access Pass
Enable a pass to be added to be created and installed on their mobile device with the constraints set in the AccessGrid console and this API call. Returns a landing page for installing the access pass.
card_template_id
string
Unique identifier for the card template to use
employee_id
string
Unique identifier for the employee
tag_id
nullable string
Tag identifier associated with the Access Pass, only allowed if your card template has key diversification enabled. Must be 7 bytes, 14 chars, ex: DF517FC87144DF
site_code
nullable string
Site code from H10301 (26 bit) format. Must be number under 255. Required if `file_data` not present.
card_number
nullable string
Card number from H10301 (26 bit) format. Must be number under 65,535. Required if `file_data` not present.
file_data
nullable string
Up to 64 characters of hexadecimal data (0-9, A-F). Only used when implementing proprietary data formats.
full_name
string
Full name of the Access Pass owner
nullable string
Email address of the Access Pass owner - if you have a SendGrid or Postmark integration, then we will send a text message on your behalf
phone_number
nullable string
Contact phone number for the Access Pass owner - if you have a Twilio integration, then we will send a text message on your behalf
classification
nullable string
Employment classification (e.g., full_time, contractor)
department
nullable string
Department of the employee (e.g., Engineering, Marketing)
location
nullable string
Workplace location of the employee
site_name
nullable string
Building or site name where the employee works
workstation
nullable string
Workstation identifier for the employee
mail_stop
nullable string
Mail stop code for the employee
company_address
nullable string
Company address associated with the employee
start_date
string
ISO8601 timestamp when the key card becomes active
temporary
boolean
False by default. Set to true if you'd like to configure the pass to be temporary. Temporary access cards may only be used for 24 hours.
expiration_date
string
ISO8601 timestamp when the key card expires. For temporary passes, this value must be less than 24 hours into the future.
employee_photo
string
Base64 encoded PNG image of the employee (max 10MB)
title
nullable string
Job title or department of the employee
member_id
nullable string
Only for 'hotel' use case. Loyalty/membership ID of the guest
membership_status
nullable string
Only for 'hotel' use case. Status of the guest's membership
is_pass_ready_to_transact
nullable boolean
Only for 'hotel' use case. Whether the pass is ready to be used for NFC transactions
tile_data
nullable object
Only for 'hotel' use case. Data for the hotel tile display
checkInAvailableWindowStartDateTime
nullable string
ISO8601 timestamp with timezone. Required if isCheckedIn is missing or false
checkInAvailableWindowEndDateTime
nullable string
ISO8601 timestamp with timezone. Required if isCheckedIn is missing or false
checkInDateTime
nullable string
ISO8601 timestamp with timezone. Required if isCheckedIn is true
checkInURL
nullable string
URL for remote check-in. Only used if isCheckedIn is missing or false
isCheckedIn
nullable boolean
Whether the guest has checked in
numberOfRoomsReserved
nullable integer
Number of rooms reserved. Must match the number of roomNumbers if both are present
roomNumbers
nullable array
Array of room numbers. Must match the number of numberOfRoomsReserved if both are present
reservations
nullable object
Only for 'hotel' use case. Data for the hotel reservation
checkInDateTime
nullable string
ISO8601 timestamp with timezone. Required if isCheckedIn is true
isCheckedIn
nullable boolean
Whether the guest has checked in
numberOfRoomsReserved
nullable integer
Number of rooms reserved. Must match the number of roomNumbers if both are present
propertyLocation
nullable string
Location of the property (e.g., 'Key West')
propertyName
nullable string
Name of the property (e.g., 'Hyatt Centric Resort & Spa')
propertyMapUrl
nullable string
URL to a map of the property
propertyCategory
nullable string
Category of the property. If provided, must be 'travel'
restaurantVoucher
nullable string
Optional voucher for restaurant services
reservationEndDateTime
nullable string
ISO8601 timestamp with timezone for reservation end
reservationNumber
nullable string
Confirmation number for the reservation
reservationStartDateTime
nullable string
ISO8601 timestamp with timezone for reservation start
roomNumbers
nullable array
Array of room numbers. Must match the number of numberOfRoomsReserved if both are present
metadata
nullable object
Custom JSON object for storing additional metadata associated with the access pass. Can contain any valid JSON data.
credential_pool_id
nullable string
Optional credential pool ID to use for automatic credential assignment. When provided, the system will automatically assign site_code and card_number from the pool.
Request
# Base64 encode the JSON
JSON=$(cat <<EOF
{
"card_template_id": "0xd3adb00b5",
"employee_id": "123456789",
"tag_id": "DDEADB33FB00B5",
"full_name": "Employee name",
"email": "[email protected]",
"phone_number": "+19547212241",
"classification": "full_time",
"department": "Engineering",
"location": "San Francisco",
"site_name": "HQ Building A",
"workstation": "4F-207",
"mail_stop": "MS-401",
"company_address": "123 Main St, San Francisco, CA 94105",
"start_date": "$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ")",
"expiration_date": "$(date -u -v+3m +"%Y-%m-%dT%H:%M:%S.%3NZ")",
"employee_photo": "[image_in_base64_encoded_format]",
"title": "Engineering Manager"
}
EOF)
JSON_B64=$(echo $JSON | base64)
# Add salt and hash
HASH=$(echo -n "$SHARED_SECRET$JSON_B64" | openssl sha256 | awk '{print $2}')
# Send curl request
curl -v \
-X POST \
-H 'X-ACCT-ID: 123' \
-H "X-PAYLOAD-SIG: $HASH" \
-d '{"example": true}' \
"https://api.accessgrid.com/v1/key-cards"
require('accessgrid')
acct_id = ENV['ACCOUNT_ID']
secret_key = ENV['SECRET_KEY']
client = AccessGrid.new(acct_id, secret_key)
card = client.access_cards.provision(
card_template_id: "0xd3adb00b5",
employee_id: "123456789",
tag_id: "DDEADB33FB00B5",
full_name: "Employee name",
email: "[email protected]",
phone_number: "+19547212241",
classification: "full_time",
department: "Engineering",
location: "San Francisco",
site_name: "HQ Building A",
workstation: "4F-207",
mail_stop: "MS-401",
company_address: "123 Main St, San Francisco, CA 94105",
start_date: Time.zone.now.utc.iso8601(3),
expiration_date: 3.months.from_now.utc.iso8601(3),
employee_photo: "[image_in_base64_encoded_format]",
title: "Engineering Manager",
metadata: {
"department": "engineering",
"badge_type": "contractor"
}
)
puts "Install URL: #{card.url}"
import AccessGrid from 'accessgrid';
const accountId = process.env.ACCOUNT_ID;
const secretKey = process.env.SECRET_KEY;
const client = new AccessGrid(accountId, secretKey);
const provision = async () => {
try {
const card = await client.accessCards.provision({
cardTemplateId: "0xd3adb00b5",
employeeId: "123456789",
tagId: "DDEADB33FB00B5",
allowOnMultipleDevices: true,
fullName: "Employee name",
email: "[email protected]",
phoneNumber: "+19547212241",
classification: "full_time",
department: "Engineering",
location: "San Francisco",
siteName: "HQ Building A",
workstation: "4F-207",
mailStop: "MS-401",
companyAddress: "123 Main St, San Francisco, CA 94105",
startDate: new Date().toISOString(),
expirationDate: new Date(Date.now() + 90 * 24 * 60 * 60 * 1000).toISOString(),
employeePhoto: "[image_in_base64_encoded_format]",
title: "Engineering Manager",
metadata: {
department: "engineering",
badgeType: "contractor"
}
});
console.log(`Install URL: ${card.url}`);
} catch (error) {
console.error('Error provisioning Access Pass:', error);
}
};
provision();
from accessgrid import AccessGrid
import os
from datetime import datetime, timezone
account_id = os.getenv('ACCOUNT_ID')
secret_key = os.getenv('SECRET_KEY')
client = AccessGrid(account_id, secret_key)
card = client.access_cards.provision(
card_template_id="0xd3adb00b5",
employee_id="123456789",
tag_id="DDEADB33FB00B5",
full_name="Employee name",
email="[email protected]",
phone_number="+19547212241",
classification="full_time",
department="Engineering",
location="San Francisco",
site_name="HQ Building A",
workstation="4F-207",
mail_stop="MS-401",
company_address="123 Main St, San Francisco, CA 94105",
start_date=datetime.now(timezone.utc).isoformat(timespec='milliseconds'),
expiration_date="2026-04-01T00:00:00.000Z",
employee_photo="[image_in_base64_encoded_format]",
title="Engineering Manager",
metadata={
"department": "engineering",
"badge_type": "contractor"
}
)
print(f"Install URL: {card.url}")
package main
import (
"context"
"fmt"
"os"
"time"
"github.com/Access-Grid/accessgrid-go"
)
func main() {
accountID := os.Getenv("ACCOUNT_ID")
secretKey := os.Getenv("SECRET_KEY")
client, err := accessgrid.NewClient(accountID, secretKey)
if err != nil {
fmt.Printf("Error creating client: %v\n", err)
return
}
params := accessgrid.ProvisionParams{
CardTemplateID: "0xd3adb00b5",
EmployeeID: "123456789",
TagID: "DDEADB33FB00B5",
AllowOnMultipleDevices: true,
FullName: "Employee name",
Email: "[email protected]",
PhoneNumber: "+19547212241",
Classification: "full_time",
Department: "Engineering",
Location: "San Francisco",
SiteName: "HQ Building A",
Workstation: "4F-207",
MailStop: "MS-401",
CompanyAddress: "123 Main St, San Francisco, CA 94105",
StartDate: time.Now().UTC(),
ExpirationDate: time.Now().UTC().AddDate(0, 3, 0),
EmployeePhoto: "[image_in_base64_encoded_format]",
Title: "Engineering Manager",
Metadata: map[string]interface{}{
"department": "engineering",
"badge_type": "contractor",
},
}
ctx := context.Background()
card, err := client.AccessCards.Provision(ctx, params)
if err != nil {
fmt.Printf("Error provisioning card: %v\n", err)
return
}
fmt.Printf("Install URL: %s\n", card.URL)
}
using AccessGrid;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
public async Task ProvisionCardAsync()
{
var accountId = Environment.GetEnvironmentVariable("ACCOUNT_ID");
var secretKey = Environment.GetEnvironmentVariable("SECRET_KEY");
using var client = new AccessGridClient(accountId, secretKey);
var card = await client.AccessCards.ProvisionAsync(new ProvisionCardRequest
{
CardTemplateId = "0xd3adb00b5",
EmployeeId = "123456789",
TagId = "DDEADB33FB00B5",
FullName = "Employee name",
Email = "[email protected]",
PhoneNumber = "+19547212241",
Classification = "full_time",
Department = "Engineering",
Location = "San Francisco",
SiteName = "HQ Building A",
Workstation = "4F-207",
MailStop = "MS-401",
CompanyAddress = "123 Main St, San Francisco, CA 94105",
StartDate = DateTime.UtcNow,
ExpirationDate = DateTime.UtcNow.AddMonths(3),
EmployeePhoto = "[image_in_base64_encoded_format]",
Title = "Engineering Manager",
Metadata = new Dictionary<string, object>
{
["department"] = "engineering",
["badge_type"] = "contractor"
}
});
Console.WriteLine($"Install URL: {card.Url}");
}
import com.organization.accessgrid.AccessGridClient;
import com.organization.accessgrid.model.ProvisionCardRequest;
import com.organization.accessgrid.model.Card;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
public class AccessCardService {
private final AccessGridClient client;
public AccessCardService() {
String accountId = System.getenv("ACCOUNT_ID");
String secretKey = System.getenv("SECRET_KEY");
this.client = new AccessGridClient(accountId, secretKey);
}
public Card provisionCard() throws AccessGridException {
ProvisionCardRequest request = ProvisionCardRequest.builder()
.cardTemplateId("0xd3adb00b5")
.employeeId("123456789")
.tagId("DDEADB33FB00B5")
.allowOnMultipleDevices(true)
.fullName("Employee name")
.email("[email protected]")
.phoneNumber("+19547212241")
.classification("full_time")
.department("Engineering")
.location("San Francisco")
.siteName("HQ Building A")
.workstation("4F-207")
.mailStop("MS-401")
.companyAddress("123 Main St, San Francisco, CA 94105")
.startDate(ZonedDateTime.now().format(DateTimeFormatter.ISO_INSTANT))
.expirationDate("2026-04-01T00:00:00.000Z")
.employeePhoto("[image_in_base64_encoded_format]")
.title("Engineering Manager")
.metadata(Map.of(
"department", "engineering",
"badge_type", "contractor"
))
.build();
Card card = client.accessCards().provision(request);
System.out.printf("Install URL: %s%n", card.getUrl());
return card;
}
}
@Getter
@Builder
public class ProvisionCardRequest {
private final String cardTemplateId;
private final String employeeId;
private final String tagId;
private final boolean allowOnMultipleDevices;
private final String fullName;
private final String email;
private final String phoneNumber;
private final String classification;
private final String startDate;
private final String expirationDate;
private final String employeePhoto;
private final String title;
}
@Getter
public class Card {
private final String url;
}
public class Example {
public static void main(String[] args) {
try {
AccessCardService service = new AccessCardService();
Card card = service.provisionCard();
} catch (AccessGridException e) {
System.err.println("Error provisioning card: " + e.getMessage());
}
}
}
<?php
require 'vendor/autoload.php';
use AccessGridClient;
$accountId = $_ENV['ACCOUNT_ID'];
$secretKey = $_ENV['SECRET_KEY'];
$client = new Client($accountId, $secretKey);
$card = $client->accessCards->provision([
'card_template_id' => '0xd3adb00b5',
'employee_id' => '123456789',
'tag_id' => 'DDEADB33FB00B5',
'full_name' => 'Employee name',
'email' => '[email protected]',
'phone_number' => '+19547212241',
'classification' => 'full_time',
'department' => 'Engineering',
'location' => 'San Francisco',
'site_name' => 'HQ Building A',
'workstation' => '4F-207',
'mail_stop' => 'MS-401',
'company_address' => '123 Main St, San Francisco, CA 94105',
'start_date' => (new DateTime('now', new DateTimeZone('UTC')))->format('c'),
'expiration_date' => '2026-04-01T00:00:00.000Z',
'employee_photo' => '[image_in_base64_encoded_format]',
'title' => 'Engineering Manager',
'metadata' => [
'department' => 'engineering',
'badge_type' => 'contractor'
]
]);
echo "Install URL: {$card->url}\n";
Response
{
"status": "success",
"install_url": "https://install.accessgrid.io/pass/key_a91c7e23",
"id": "key_a91c7e23",
"state": "active",
"temporary": false,
"full_name": "Employee name",
"expiration_date": "2026-03-29T15:34:40.072Z",
"metadata": {
"department": "engineering",
"badgeType": "contractor"
},
"card_number": "8472-1093-5561",
"site_code": "ENG-HQ-01",
"file_data": null
}
Get Issued Pass
Retrieve details about a specific issued Access Pass, including its state, devices, and metadata
card_id
string
Unique identifier of the Access Pass to retrieve, sent as part of the URL
Request
# Base64 encode the JSON
JSON=$(cat <<EOF
{
"card_id": "0xc4rd1d"
}
EOF)
JSON_B64=$(echo $JSON | base64)
# Add salt and hash
HASH=$(echo -n "$SHARED_SECRET$JSON_B64" | openssl sha256 | awk '{print $2}')
# Send curl request
curl -v \
-X GET \
-H 'X-ACCT-ID: 123' \
-H "X-PAYLOAD-SIG: $HASH" \
"https://api.accessgrid.com/v1/key-cards/0xc4rd1d"
require 'accessgrid'
acct_id = ENV['ACCOUNT_ID']
secret_key = ENV['SECRET_KEY']
client = AccessGrid.new(acct_id, secret_key)
card = client.access_cards.get(card_id: "0xc4rd1d")
puts "Card ID: #{card.id}"
puts "State: #{card.state}"
puts "Full Name: #{card.full_name}"
puts "Install URL: #{card.install_url}"
puts "Expiration Date: #{card.expiration_date}"
puts "Card Number: #{card.card_number}"
puts "Site Code: #{card.site_code}"
puts "Devices: #{card.devices.length}"
puts "Metadata: #{card.metadata}"
import AccessGrid from 'accessgrid';
const accountId = process.env.ACCOUNT_ID;
const secretKey = process.env.SECRET_KEY;
const client = new AccessGrid(accountId, secretKey);
const getCard = async () => {
try {
const card = await client.accessCards.get({
cardId: "0xc4rd1d"
});
console.log('Card ID:', card.id);
console.log('State:', card.state);
console.log('Full Name:', card.fullName);
console.log('Install URL:', card.installUrl);
console.log('Expiration Date:', card.expirationDate);
console.log('Card Number:', card.cardNumber);
console.log('Site Code:', card.siteCode);
console.log('Devices:', card.devices);
console.log('Metadata:', card.metadata);
} catch (error) {
console.error('Error retrieving Access Pass:', error);
}
};
getCard();
from accessgrid import AccessGrid
import os
account_id = os.getenv('ACCOUNT_ID')
secret_key = os.getenv('SECRET_KEY')
client = AccessGrid(account_id, secret_key)
card = client.access_cards.get(card_id="0xc4rd1d")
print(f"Card ID: {card.id}")
print(f"State: {card.state}")
print(f"Full Name: {card.full_name}")
print(f"Install URL: {card.install_url}")
print(f"Expiration Date: {card.expiration_date}")
print(f"Card Number: {card.card_number}")
print(f"Site Code: {card.site_code}")
print(f"Devices: {len(card.devices)}")
print(f"Metadata: {card.metadata}")
package main
import (
"context"
"fmt"
"os"
"github.com/Access-Grid/accessgrid-go"
)
func main() {
accountID := os.Getenv("ACCOUNT_ID")
secretKey := os.Getenv("SECRET_KEY")
client, err := accessgrid.NewClient(accountID, secretKey)
if err != nil {
fmt.Printf("Error creating client: %v\n", err)
return
}
ctx := context.Background()
card, err := client.AccessCards.Get(ctx, "0xc4rd1d")
if err != nil {
fmt.Printf("Error retrieving card: %v\n", err)
return
}
fmt.Printf("Card ID: %s\n", card.ID)
fmt.Printf("State: %s\n", card.State)
fmt.Printf("Full Name: %s\n", card.FullName)
fmt.Printf("Install URL: %s\n", card.InstallURL)
fmt.Printf("Expiration Date: %s\n", card.ExpirationDate)
fmt.Printf("Card Number: %s\n", card.CardNumber)
fmt.Printf("Site Code: %s\n", card.SiteCode)
fmt.Printf("Devices: %d\n", len(card.Devices))
fmt.Printf("Metadata: %v\n", card.Metadata)
}
using AccessGrid;
using System;
using System.Threading.Tasks;
public async Task GetCardAsync()
{
var accountId = Environment.GetEnvironmentVariable("ACCOUNT_ID");
var secretKey = Environment.GetEnvironmentVariable("SECRET_KEY");
using var client = new AccessGridClient(accountId, secretKey);
var card = await client.AccessCards.GetAsync("0xc4rd1d");
Console.WriteLine($"Card ID: {card.Id}");
Console.WriteLine($"State: {card.State}");
Console.WriteLine($"Full Name: {card.FullName}");
Console.WriteLine($"Install URL: {card.Url}");
Console.WriteLine($"Expiration Date: {card.ExpirationDate}");
Console.WriteLine($"Card Number: {card.CardNumber}");
Console.WriteLine($"Site Code: {card.SiteCode}");
Console.WriteLine($"Devices: {card.Devices.Count}");
Console.WriteLine($"Metadata: {card.Metadata}");
}
import com.organization.accessgrid.AccessGridClient;
import com.organization.accessgrid.model.Card;
public class AccessCardService {
private final AccessGridClient client;
public AccessCardService() {
String accountId = System.getenv("ACCOUNT_ID");
String secretKey = System.getenv("SECRET_KEY");
this.client = new AccessGridClient(accountId, secretKey);
}
public void getCard() throws AccessGridException {
Card card = client.accessCards().get("0xc4rd1d");
System.out.println("Card ID: " + card.getId());
System.out.println("State: " + card.getState());
System.out.println("Full Name: " + card.getFullName());
System.out.println("Install URL: " + card.getInstallUrl());
System.out.println("Expiration Date: " + card.getExpirationDate());
System.out.println("Card Number: " + card.getCardNumber());
System.out.println("Site Code: " + card.getSiteCode());
System.out.println("Devices: " + card.getDevices().size());
System.out.println("Metadata: " + card.getMetadata());
}
}
<?php
require 'vendor/autoload.php';
use AccessGridClient;
$accountId = $_ENV['ACCOUNT_ID'];
$secretKey = $_ENV['SECRET_KEY'];
$client = new Client($accountId, $secretKey);
$card = $client->accessCards->get('0xc4rd1d');
echo "Card ID: {$card->id}\n";
echo "State: {$card->state}\n";
echo "Full Name: {$card->full_name}\n";
echo "Install URL: {$card->install_url}\n";
echo "Expiration Date: {$card->expiration_date}\n";
echo "Card Number: {$card->card_number}\n";
echo "Site Code: {$card->site_code}\n";
echo "Devices: " . count($card->devices) . "\n";
echo "Metadata: " . json_encode($card->metadata) . "\n";
Response
{
"status": "success",
"install_url": "https://install.accessgrid.io/pass/key_a91c7e23",
"id": "key_a91c7e23",
"state": "active",
"temporary": false,
"full_name": "Employee name",
"expiration_date": "2026-03-29T15:34:40.072Z",
"metadata": {
"department": "engineering",
"badgeType": "contractor"
},
"card_number": "8472-1093-5561",
"site_code": "ENG-HQ-01",
"file_data": {
"file_name": "access_pass.pkpass",
"file_size": 31245,
"content_type": "application/vnd.apple.pkpass"
},
"devices": [
{
"id": "dev_7f3b2a9c",
"platform": "ios",
"device_type": "iphone",
"status": "active"
},
{
"id": "dev_c91d88aa",
"platform": "android",
"device_type": "phone",
"status": "pending_install"
}
]
}
Update Access Pass
When you need to make an informational update to an Access Pass such as name, photo, etc
card_id
string
Unique identifier of the Access Pass to update, sent as part of the URL
employee_id
nullable string
Updated unique identifier for the employee
full_name
nullable string
Updated full name of the Access Pass owner
classification
nullable string
Updated employment classification (e.g., full_time, contractor)
department
nullable string
Updated department of the employee
location
nullable string
Updated workplace location of the employee
site_name
nullable string
Updated building or site name where the employee works
workstation
nullable string
Updated workstation identifier for the employee
mail_stop
nullable string
Updated mail stop code for the employee
company_address
nullable string
Updated company address associated with the employee
expiration_date
nullable string
Updated ISO8601 timestamp when the card expires
employee_photo
nullable string
Updated base64 encoded PNG image of the employee (max 10MB)
title
nullable string
Updated job title or department of the employee
file_data
nullable string
Up to 64 characters of hexadecimal data (0-9, A-F). Only used when implementing proprietary data formats.
is_pass_ready_to_transact
nullable boolean
Only for 'hotel' use case. Whether the pass is ready to be used for NFC transactions
tile_data
nullable object
Only for 'hotel' use case. Data for the hotel tile display
checkInAvailableWindowStartDateTime
nullable string
ISO8601 timestamp with timezone. Required if isCheckedIn is missing or false
checkInAvailableWindowEndDateTime
nullable string
ISO8601 timestamp with timezone. Required if isCheckedIn is missing or false
checkInDateTime
nullable string
ISO8601 timestamp with timezone. Required if isCheckedIn is true
checkInURL
nullable string
URL for remote check-in. Only used if isCheckedIn is missing or false
isCheckedIn
nullable boolean
Whether the guest has checked in
numberOfRoomsReserved
nullable integer
Number of rooms reserved. Must match the number of roomNumbers if both are present
roomNumbers
nullable array
Array of room numbers. Must match the number of numberOfRoomsReserved if both are present
reservations
nullable object
Only for 'hotel' use case. Data for the hotel reservation
checkInDateTime
nullable string
ISO8601 timestamp with timezone. Required if isCheckedIn is true
isCheckedIn
nullable boolean
Whether the guest has checked in
numberOfRoomsReserved
nullable integer
Number of rooms reserved. Must match the number of roomNumbers if both are present
propertyLocation
nullable string
Location of the property (e.g., 'Key West')
propertyName
nullable string
Name of the property (e.g., 'Hyatt Centric Resort & Spa')
propertyMapUrl
nullable string
URL to a map of the property
propertyCategory
nullable string
Category of the property. If provided, must be 'travel'
restaurantVoucher
nullable string
Optional voucher for restaurant services
reservationEndDateTime
nullable string
ISO8601 timestamp with timezone for reservation end
reservationNumber
nullable string
Confirmation number for the reservation
reservationStartDateTime
nullable string
ISO8601 timestamp with timezone for reservation start
roomNumbers
nullable array
Array of room numbers. Must match the number of numberOfRoomsReserved if both are present
metadata
nullable object
Custom JSON object for storing additional metadata associated with the access pass. Can contain any valid JSON data.
Request
# Base64 encode the JSON
JSON=$(cat <<EOF
{
"employee_id": "987654321",
"full_name": "Updated Employee Name",
"classification": "contractor",
"department": "Marketing",
"location": "New York",
"site_name": "NYC Office",
"workstation": "2F-105",
"mail_stop": "MS-200",
"company_address": "456 Broadway, New York, NY 10013",
"expiration_date": "2025-02-22T21:04:03.664Z",
"title": "Senior Developer"
}
EOF)
JSON_B64=$(echo $JSON | base64)
# Add salt and hash
HASH=$(echo -n "$SHARED_SECRET$JSON_B64" | openssl sha256 | awk '{print $2}')
curl -v \
-X PATCH \
-H 'X-ACCT-ID: 123' \
-H "X-PAYLOAD-SIG: $HASH" \
-d '{
"card_id": "0xc4rd1d",
"employee_id": "987654321",
"full_name": "Updated Employee Name",
"classification": "contractor",
"department": "Marketing",
"location": "New York",
"site_name": "NYC Office",
"workstation": "2F-105",
"mail_stop": "MS-200",
"company_address": "456 Broadway, New York, NY 10013",
"expiration_date": "2025-02-22T21:04:03.664Z",
"title": "Senior Developer"
}' \
"https://api.accessgrid.com/v1/key-cards/{card_id}"
require 'accessgrid'
acct_id = ENV['ACCOUNT_ID']
secret_key = ENV['SECRET_KEY']
client = AccessGrid.new(acct_id, secret_key)
card = client.access_cards.update(
card_id: "0xc4rd1d",
employee_id: "987654321",
full_name: "Updated Employee Name",
classification: "contractor",
department: "Marketing",
location: "New York",
site_name: "NYC Office",
workstation: "2F-105",
mail_stop: "MS-200",
company_address: "456 Broadway, New York, NY 10013",
expiration_date: 3.months.from_now.utc.iso8601(3),
employee_photo: "[image_in_base64_encoded_format]",
title: "Senior Developer"
)
puts "Card updated successfully"
import AccessGrid from 'accessgrid';
const accountId = process.env.ACCOUNT_ID;
const secretKey = process.env.SECRET_KEY;
const client = new AccessGrid(accountId, secretKey);
const update = async () => {
try {
const card = await client.accessCards.update({
cardId: "0xc4rd1d",
employeeId: "987654321",
fullName: "Updated Employee Name",
classification: "contractor",
department: "Marketing",
location: "New York",
siteName: "NYC Office",
workstation: "2F-105",
mailStop: "MS-200",
companyAddress: "456 Broadway, New York, NY 10013",
expirationDate: "2025-02-22T21:04:03.664Z",
employeePhoto: "[image_in_base64_encoded_format]",
title: "Senior Developer"
});
console.log('Card updated successfully');
} catch (error) {
console.error('Error updating Access Pass:', error);
}
};
update();
from accessgrid import AccessGrid
import os
from datetime import datetime, timezone, timedelta
account_id = os.getenv('ACCOUNT_ID')
secret_key = os.getenv('SECRET_KEY')
client = AccessGrid(account_id, secret_key)
card = client.access_cards.update(
card_id="0xc4rd1d",
employee_id="987654321",
full_name="Updated Employee Name",
classification="contractor",
department="Marketing",
location="New York",
site_name="NYC Office",
workstation="2F-105",
mail_stop="MS-200",
company_address="456 Broadway, New York, NY 10013",
expiration_date=(datetime.now(timezone.utc) + timedelta(days=90)).isoformat(),
employee_photo="[image_in_base64_encoded_format]",
title="Senior Developer"
)
print("Card updated successfully")
package main
import (
"context"
"fmt"
"os"
"time"
"github.com/Access-Grid/accessgrid-go"
)
func main() {
accountID := os.Getenv("ACCOUNT_ID")
secretKey := os.Getenv("SECRET_KEY")
client, err := accessgrid.NewClient(accountID, secretKey)
if err != nil {
fmt.Printf("Error creating client: %v\n", err)
return
}
expDate := time.Now().UTC().AddDate(0, 3, 0)
params := accessgrid.UpdateParams{
CardID: "0xc4rd1d",
EmployeeID: "987654321",
FullName: "Updated Employee Name",
Classification: "contractor",
Department: "Marketing",
Location: "New York",
SiteName: "NYC Office",
Workstation: "2F-105",
MailStop: "MS-200",
CompanyAddress: "456 Broadway, New York, NY 10013",
ExpirationDate: &expDate,
EmployeePhoto: "[image_in_base64_encoded_format]",
Title: "Senior Developer",
}
ctx := context.Background()
card, err := client.AccessCards.Update(ctx, params)
if err != nil {
fmt.Printf("Error updating card: %v\n", err)
return
}
fmt.Println("Card updated successfully")
}
using AccessGrid;
using System;
using System.Threading.Tasks;
public async Task UpdateCardAsync()
{
var accountId = Environment.GetEnvironmentVariable("ACCOUNT_ID");
var secretKey = Environment.GetEnvironmentVariable("SECRET_KEY");
using var client = new AccessGridClient(accountId, secretKey);
await client.AccessCards.UpdateAsync("0xc4rd1d", new UpdateCardRequest
{
EmployeeId = "987654321",
FullName = "Updated Employee Name",
Classification = "contractor",
Department = "Marketing",
Location = "New York",
SiteName = "NYC Office",
Workstation = "2F-105",
MailStop = "MS-200",
CompanyAddress = "456 Broadway, New York, NY 10013",
ExpirationDate = DateTime.UtcNow.AddMonths(3),
EmployeePhoto = "[image_in_base64_encoded_format]",
Title = "Senior Developer"
});
Console.WriteLine("Card updated successfully");
}
import com.organization.accessgrid.AccessGridClient;
import com.organization.accessgrid.model.UpdateCardRequest;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
public class AccessCardService {
private final AccessGridClient client;
public AccessCardService() {
String accountId = System.getenv("ACCOUNT_ID");
String secretKey = System.getenv("SECRET_KEY");
this.client = new AccessGridClient(accountId, secretKey);
}
public void updateCard() throws AccessGridException {
UpdateCardRequest request = UpdateCardRequest.builder()
.cardId("0xc4rd1d")
.employeeId("987654321")
.fullName("Updated Employee Name")
.classification("contractor")
.department("Marketing")
.location("New York")
.siteName("NYC Office")
.workstation("2F-105")
.mailStop("MS-200")
.companyAddress("456 Broadway, New York, NY 10013")
.expirationDate(ZonedDateTime.now().plusMonths(3).format(DateTimeFormatter.ISO_INSTANT))
.employeePhoto("[image_in_base64_encoded_format]")
.title("Senior Developer")
.build();
client.accessCards().update(request);
System.out.println("Card updated successfully");
}
}
<?php
require 'vendor/autoload.php';
use AccessGridClient;
$accountId = $_ENV['ACCOUNT_ID'];
$secretKey = $_ENV['SECRET_KEY'];
$client = new Client($accountId, $secretKey);
$card = $client->accessCards->update([
'card_id' => '0xc4rd1d',
'employee_id' => '987654321',
'full_name' => 'Updated Employee Name',
'classification' => 'contractor',
'department' => 'Marketing',
'location' => 'New York',
'site_name' => 'NYC Office',
'workstation' => '2F-105',
'mail_stop' => 'MS-200',
'company_address' => '456 Broadway, New York, NY 10013',
'expiration_date' => (new DateTime('now', new DateTimeZone('UTC')))->modify('+3 months')->format('c'),
'employee_photo' => '[image_in_base64_encoded_format]',
'title' => 'Senior Developer'
]);
echo "Card updated successfully\n";
Response
{
"status": "success",
"install_url": "https://install.accessgrid.io/pass/key_a91c7e23",
"id": "key_a91c7e23",
"state": "active",
"temporary": false,
"full_name": "Updated Employee Name",
"expiration_date": "2026-06-15T23:59:59Z",
"metadata": {
"department": "engineering",
"badgeType": "contractor"
},
"card_number": "8472-1093-5561",
"site_code": "ENG-HQ-01",
"file_data": null
}
Suspend Access Pass
When you need to temporarily disable an Access Pass for a short period of time
card_id
string
Unique identifier of the Access Pass to suspend, sent as part of the URL
Request
# Base64 encode the JSON
JSON='{ "card_id": "0xc4rd1d" }'
JSON_B64=$(echo $JSON | base64)
# Add salt and hash
HASH=$(echo -n "$SHARED_SECRET$JSON_B64" | openssl sha256 | awk '{print $2}')
curl -v \
-X POST \
-H 'X-ACCT-ID: 123' \
-H "X-PAYLOAD-SIG: $HASH" \
"https://api.accessgrid.com/v1/key-cards/{card_id}/suspend"
require 'accessgrid'
acct_id = ENV['ACCOUNT_ID']
secret_key = ENV['SECRET_KEY']
client = AccessGrid.new(acct_id, secret_key)
card = client.access_cards.suspend(
card_id: "0xc4rd1d"
)
puts "Card suspended successfully"
import AccessGrid from 'accessgrid';
const accountId = process.env.ACCOUNT_ID;
const secretKey = process.env.SECRET_KEY;
const client = new AccessGrid(accountId, secretKey);
const suspend = async () => {
try {
await client.accessCards.suspend({
cardId: "0xc4rd1d"
});
console.log('Card suspended successfully');
} catch (error) {
console.error('Error suspending Access Pass:', error);
}
};
suspend();
from accessgrid import AccessGrid
import os
account_id = os.getenv('ACCOUNT_ID')
secret_key = os.getenv('SECRET_KEY')
client = AccessGrid(account_id, secret_key)
card = client.access_cards.suspend(
card_id="0xc4rd1d"
)
print("Card suspended successfully")
package main
import (
"context"
"fmt"
"os"
"github.com/Access-Grid/accessgrid-go"
)
func main() {
accountID := os.Getenv("ACCOUNT_ID")
secretKey := os.Getenv("SECRET_KEY")
client, err := accessgrid.NewClient(accountID, secretKey)
if err != nil {
fmt.Printf("Error creating client: %v\n", err)
return
}
ctx := context.Background()
err = client.AccessCards.Suspend(ctx, "0xc4rd1d")
if err != nil {
fmt.Printf("Error suspending card: %v\n", err)
return
}
fmt.Println("Card suspended successfully")
}
using AccessGrid;
public async Task SuspendCardAsync()
{
var accountId = Environment.GetEnvironmentVariable("ACCOUNT_ID");
var secretKey = Environment.GetEnvironmentVariable("SECRET_KEY");
var client = new AccessGridClient(accountId, secretKey);
await client.AccessCards.SuspendAsync("0xc4rd1d");
Console.WriteLine("Card suspended successfully");
}
import com.organization.accessgrid.AccessGridClient;
public class AccessCardService {
private final AccessGridClient client;
public AccessCardService() {
String accountId = System.getenv("ACCOUNT_ID");
String secretKey = System.getenv("SECRET_KEY");
this.client = new AccessGridClient(accountId, secretKey);
}
public void suspendCard() throws AccessGridException {
client.accessCards().suspend("0xc4rd1d");
System.out.println("Card suspended successfully");
}
}
<?php
require 'vendor/autoload.php';
use AccessGridClient;
$accountId = $_ENV['ACCOUNT_ID'];
$secretKey = $_ENV['SECRET_KEY'];
$client = new Client($accountId, $secretKey);
$client->accessCards->suspend([
'card_id' => '0xc4rd1d'
]);
echo "Card suspended successfully\n";
Response
{
"status": "success",
"install_url": "https://install.accessgrid.io/pass/key_a91c7e23",
"id": "key_a91c7e23",
"state": "suspended",
"temporary": false,
"full_name": "Employee name",
"expiration_date": "2026-06-15T23:59:59Z",
"metadata": {},
"card_number": "8472-1093-5561",
"site_code": "ENG-HQ-01",
"file_data": null
}
Resume Access Pass
If you have previously suspended an Access Pass, you can re-enable it with the resume action
card_id
string
Unique identifier of the Access Pass to resume, sent as part of the URL
Request
# Base64 encode the JSON
JSON='{ "card_id": "0xc4rd1d" }'
JSON_B64=$(echo $JSON | base64)
# Add salt and hash
HASH=$(echo -n "$SHARED_SECRET$JSON_B64" | openssl sha256 | awk '{print $2}')
curl -v \
-X POST \
-H 'X-ACCT-ID: 123' \
-H "X-PAYLOAD-SIG: $HASH" \
-d '{
"card_id": "0xc4rd1d"
}' \
"https://api.accessgrid.com/v1/key-cards/{card_id}/resume"
require 'accessgrid'
acct_id = ENV['ACCOUNT_ID']
secret_key = ENV['SECRET_KEY']
client = AccessGrid.new(acct_id, secret_key)
card = client.access_cards.resume(
card_id: "0xc4rd1d"
)
puts "Card resumed successfully"
import AccessGrid from 'accessgrid';
const accountId = process.env.ACCOUNT_ID;
const secretKey = process.env.SECRET_KEY;
const client = new AccessGrid(accountId, secretKey);
const resume = async () => {
try {
await client.accessCards.resume({
cardId: "0xc4rd1d"
});
console.log('Card resumed successfully');
} catch (error) {
console.error('Error resuming Access Pass:', error);
}
};
resume();
from accessgrid import AccessGrid
import os
account_id = os.getenv('ACCOUNT_ID')
secret_key = os.getenv('SECRET_KEY')
client = AccessGrid(account_id, secret_key)
card = client.access_cards.resume(
card_id="0xc4rd1d"
)
print("Card resumed successfully")
package main
import (
"context"
"fmt"
"os"
"github.com/Access-Grid/accessgrid-go"
)
func main() {
accountID := os.Getenv("ACCOUNT_ID")
secretKey := os.Getenv("SECRET_KEY")
client, err := accessgrid.NewClient(accountID, secretKey)
if err != nil {
fmt.Printf("Error creating client: %v\n", err)
return
}
ctx := context.Background()
err = client.AccessCards.Resume(ctx, "0xc4rd1d")
if err != nil {
fmt.Printf("Error resuming card: %v\n", err)
return
}
fmt.Println("Card resumed successfully")
}
using AccessGrid;
public async Task ResumeCardAsync()
{
var accountId = Environment.GetEnvironmentVariable("ACCOUNT_ID");
var secretKey = Environment.GetEnvironmentVariable("SECRET_KEY");
var client = new AccessGridClient(accountId, secretKey);
await client.AccessCards.ResumeAsync("0xc4rd1d");
Console.WriteLine("Card resumed successfully");
}
import com.organization.accessgrid.AccessGridClient;
public class AccessCardService {
private final AccessGridClient client;
public AccessCardService() {
String accountId = System.getenv("ACCOUNT_ID");
String secretKey = System.getenv("SECRET_KEY");
this.client = new AccessGridClient(accountId, secretKey);
}
public void resumeCard() throws AccessGridException {
client.accessCards().resume("0xc4rd1d");
System.out.println("Card resumed successfully");
}
}
<?php
require 'vendor/autoload.php';
use AccessGridClient;
$accountId = $_ENV['ACCOUNT_ID'];
$secretKey = $_ENV['SECRET_KEY'];
$client = new Client($accountId, $secretKey);
$client->accessCards->resume([
'card_id' => '0xc4rd1d'
]);
echo "Card resumed successfully\n";
Response
{
"status": "success",
"install_url": "https://install.accessgrid.io/pass/key_a91c7e23",
"id": "key_a91c7e23",
"state": "active",
"temporary": false,
"full_name": "Employee name",
"expiration_date": "2026-06-15T23:59:59Z",
"metadata": {},
"card_number": "8472-1093-5561",
"site_code": "ENG-HQ-01",
"file_data": null
}
Unlink Access Pass
If you'd like to force the removal of an Access Pass from it's current holder - unlinking does not make a key uninstallable, it simply disables it on the users phone.
card_id
string
Unique identifier of the Access Pass to unlink from its current holder, sent as part of the URL
Request
# Base64 encode the JSON
JSON='{ "card_id": "0xc4rd1d" }'
JSON_B64=$(echo $JSON | base64)
# Add salt and hash
HASH=$(echo -n "$SHARED_SECRET$JSON_B64" | openssl sha256 | awk '{print $2}')
curl -v \
-X POST \
-H 'X-ACCT-ID: 123' \
-H "X-PAYLOAD-SIG: $HASH" \
-d '{
"card_id": "0xc4rd1d"
}' \
"https://api.accessgrid.com/v1/key-cards/{card_id}/unlink"
require 'accessgrid'
acct_id = ENV['ACCOUNT_ID']
secret_key = ENV['SECRET_KEY']
client = AccessGrid.new(acct_id, secret_key)
card = client.access_cards.unlink(
card_id: "0xc4rd1d"
)
puts "Card unlinked successfully"
import AccessGrid from 'accessgrid';
const accountId = process.env.ACCOUNT_ID;
const secretKey = process.env.SECRET_KEY;
const client = new AccessGrid(accountId, secretKey);
const unlink = async () => {
try {
await client.accessCards.unlink({
cardId: "0xc4rd1d"
});
console.log('Card unlinked successfully');
} catch (error) {
console.error('Error unlinking Access Pass:', error);
}
};
unlink();
from accessgrid import AccessGrid
import os
account_id = os.getenv('ACCOUNT_ID')
secret_key = os.getenv('SECRET_KEY')
client = AccessGrid(account_id, secret_key)
card = client.access_cards.unlink(
card_id="0xc4rd1d"
)
print("Card unlinked successfully")
package main
import (
"context"
"fmt"
"os"
"github.com/Access-Grid/accessgrid-go"
)
func main() {
accountID := os.Getenv("ACCOUNT_ID")
secretKey := os.Getenv("SECRET_KEY")
client, err := accessgrid.NewClient(accountID, secretKey)
if err != nil {
fmt.Printf("Error creating client: %v\n", err)
return
}
ctx := context.Background()
err = client.AccessCards.Unlink(ctx, "0xc4rd1d")
if err != nil {
fmt.Printf("Error unlinking card: %v\n", err)
return
}
fmt.Println("Card unlinked successfully")
}
using AccessGrid;
public async Task UnlinkCardAsync()
{
var accountId = Environment.GetEnvironmentVariable("ACCOUNT_ID");
var secretKey = Environment.GetEnvironmentVariable("SECRET_KEY");
var client = new AccessGridClient(accountId, secretKey);
await client.AccessCards.UnlinkAsync("0xc4rd1d");
Console.WriteLine("Card unlinked successfully");
}
import com.organization.accessgrid.AccessGridClient;
public class AccessCardService {
private final AccessGridClient client;
public AccessCardService() {
String accountId = System.getenv("ACCOUNT_ID");
String secretKey = System.getenv("SECRET_KEY");
this.client = new AccessGridClient(accountId, secretKey);
}
public void unlinkCard() throws AccessGridException {
client.accessCards().unlink("0xc4rd1d");
System.out.println("Card unlinked successfully");
}
}
<?php
require 'vendor/autoload.php';
use AccessGridClient;
$accountId = $_ENV['ACCOUNT_ID'];
$secretKey = $_ENV['SECRET_KEY'];
$client = new Client($accountId, $secretKey);
$client->accessCards->unlink([
'card_id' => '0xc4rd1d'
]);
echo "Card unlinked successfully\n";
Response
{
"status": "success",
"install_url": "https://install.accessgrid.io/pass/key_a91c7e23",
"id": "key_a91c7e23",
"state": "unlink",
"temporary": false,
"full_name": "Employee name",
"expiration_date": "2026-06-15T23:59:59Z",
"metadata": {},
"card_number": "8472-1093-5561",
"site_code": "ENG-HQ-01",
"file_data": null
}
Delete Access Pass
If you'd like to delete Access Pass and prevent additional installs - deleting a key unlinks it and makes prevents any additional installs
card_id
string
Unique identifier of the Access Pass to delete, sent as part of the URL
Request
# Base64 encode the JSON
JSON='{ "card_id": "0xc4rd1d" }'
JSON_B64=$(echo $JSON | base64)
# Add salt and hash
HASH=$(echo -n "$SHARED_SECRET$JSON_B64" | openssl sha256 | awk '{print $2}')
curl -v \
-X POST \
-H 'X-ACCT-ID: 123' \
-H "X-PAYLOAD-SIG: $HASH" \
-d '{
"card_id": "0xc4rd1d"
}' \
"https://api.accessgrid.com/v1/key-cards/{card_id}/delete"
require 'accessgrid'
acct_id = ENV['ACCOUNT_ID']
secret_key = ENV['SECRET_KEY']
client = AccessGrid.new(acct_id, secret_key)
card = client.access_cards.delete(
card_id: "0xc4rd1d"
)
puts "Card deleted successfully"
import AccessGrid from 'accessgrid';
const accountId = process.env.ACCOUNT_ID;
const secretKey = process.env.SECRET_KEY;
const client = new AccessGrid(accountId, secretKey);
const del = async () => {
try {
await client.accessCards.delete({
cardId: "0xc4rd1d"
});
console.log('Card delete successfully');
} catch (error) {
console.error('Error deleting Access Pass:', error);
}
};
del();
from accessgrid import AccessGrid
import os
account_id = os.getenv('ACCOUNT_ID')
secret_key = os.getenv('SECRET_KEY')
client = AccessGrid(account_id, secret_key)
card = client.access_cards.delete(
card_id="0xc4rd1d"
)
print("Card deleted successfully")
package main
import (
"context"
"fmt"
"os"
"github.com/Access-Grid/accessgrid-go"
)
func main() {
accountID := os.Getenv("ACCOUNT_ID")
secretKey := os.Getenv("SECRET_KEY")
client, err := accessgrid.NewClient(accountID, secretKey)
if err != nil {
fmt.Printf("Error creating client: %v\n", err)
return
}
ctx := context.Background()
err = client.AccessCards.Delete(ctx, "0xc4rd1d")
if err != nil {
fmt.Printf("Error deleting card: %v\n", err)
return
}
fmt.Println("Card deleted successfully")
}
using AccessGrid;
public async Task DeleteCardAsync()
{
var accountId = Environment.GetEnvironmentVariable("ACCOUNT_ID");
var secretKey = Environment.GetEnvironmentVariable("SECRET_KEY");
var client = new AccessGridClient(accountId, secretKey);
await client.AccessCards.DeleteAsync("0xc4rd1d");
Console.WriteLine("Card deleted successfully");
}
import com.organization.accessgrid.AccessGridClient;
public class AccessCardService {
private final AccessGridClient client;
public AccessCardService() {
String accountId = System.getenv("ACCOUNT_ID");
String secretKey = System.getenv("SECRET_KEY");
this.client = new AccessGridClient(accountId, secretKey);
}
public void deleteCard() throws AccessGridException {
client.accessCards().delete("0xc4rd1d");
System.out.println("Card deleted successfully");
}
}
<?php
require 'vendor/autoload.php';
use AccessGridClient;
$accountId = $_ENV['ACCOUNT_ID'];
$secretKey = $_ENV['SECRET_KEY'];
$client = new Client($accountId, $secretKey);
$client->accessCards->delete([
'card_id' => '0xc4rd1d'
]);
echo "Card deleted successfully\n";
Response
{
"status": "success",
"install_url": "https://install.accessgrid.io/pass/key_a91c7e23",
"id": "key_a91c7e23",
"state": "deleted",
"temporary": false,
"full_name": "Employee name",
"expiration_date": "2026-06-15T23:59:59Z",
"metadata": {},
"card_number": "8472-1093-5561",
"site_code": "ENG-HQ-01",
"file_data": null
}