//native
type Basistheory = {
apiKey: string;
};
/**
* Tokens Create
* Tokens Create
*/
export async function main(
auth: Basistheory,
body: {
containers?: string[];
data?: { nullable?: false | true };
deduplicate_token?: string;
expires_at?: string;
fingerprint_expression?: string;
id?: string;
mask?: { nullable?: false | true };
metadata?: { laboris_aa?: string };
privacy?: {
classification?: string;
impact_level?: string;
restriction_policy?: string;
};
search_indexes?: string[];
token_intent_id?: string;
type?: string;
},
) {
const url = new URL(`https://api.basistheory.com/tokens`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"BT-API-KEY": auth.apiKey,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago