For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
GuidesAPI Reference
GuidesAPI Reference
  • Reference
    • Introduction
      • POSTCreate Grant Approval
      • POSTCreate Grant
      • GETRetrieve Grant
      • POSTRevoke Grant
      • POSTCreate Grant Alias
      • POSTStart Grant Link Flow
      • POSTGrant status updated
LogoLogo
ReferenceGrants - Afterpay

Create Grant

POST
/v2/grants
POST
/v2/grants
$curl -X POST https://global-api-sandbox.afterpay.com/v2/grants \
> -H "Content-Type: application/json" \
> -u "<username>:<password>" \
> -d '{
> "requestId": "123e4567-e89b-12d3-a456-426614174000",
> "token": "005.2fkv5o963b132z8ppa34srlh60987y87d55re237wsg9tr4q2"
>}'
1{
2 "grant": {
3 "id": "005.2fkv5o963b132z8ppa34srlh60987y87d55re237wsg9tr4q2",
4 "type": "ON_FILE",
5 "status": "ACTIVE",
6 "created": "2024-03-04T12:00:00Z",
7 "merchantReference": "merchant_ref_123",
8 "cancelled": "2024-03-05T12:00:00Z",
9 "expires": "2025-03-04T12:00:00Z",
10 "consumerReference": "cust_12345",
11 "email": "j***@e***.com",
12 "requestId": "req_abc123def456"
13 }
14}
Creates a new grant from a grant approval token.
Was this page helpful?
Previous

Retrieve Grant

Next
Built with

Authentication

AuthorizationBasic

Basic authentication of the form Basic <base64(username:password)>.

Headers

AcceptstringOptionalDefaults to application/json

Request

This endpoint expects an object.
requestIdstringRequired<=64 characters
A unique request ID, required for idempotent retries. It is recommended that the merchant generate a UUID for each unique request.
tokenstringRequired
The token returned from the create approval request.
codestringOptional

The one-time code received from the consumer. Note: The code will only be sent with the headless integration.

Response

Created
grantobject

Errors

403
Forbidden Error
412
Precondition Failed Error
415
Unsupported Media Type Error