POST /api/v2/server-side-api/purchase/profile/grant/access-level/

Grant access level

Provides access level to your end-user without providing info on the transaction. This comes in handy if you have bonuses for referrals or other events related to your products. The access level provided by this method will not be reflected in your analytics. It will be sent to only webhook integration, and only in this case will appear in the Event Feed.

Header parameters

adapty-customer-user-idstring

The unique ID of the customer in your system. Either adapty-customer-user-id or adapty-profile-id is required.

adapty-profile-idstring

The unique ID of the profile in your system. Your best option if you are working with anonymous profiles. Either adapty-customer-user-id or adapty-profile-id is required.

Request body

access_level_idstringrequired

Paid access level ID configured in the Access Levels page

starts_atstring

The datetime when the access level will be active. Maybe in the future. The default value is null.

expires_atstring

The datetime when the access level will expire. It may be in the past and may be null for lifetime access. The default value is null.

Responses

Access level granted successfully

Schema
dataobjectrequired
app_idstringrequired

The internal ID of your app

profile_idstringrequired

Adapty profile ID

customer_user_idstringrequired

The ID of your user in your system

total_revenue_usdnumberrequired

A float value representing the total revenue in USD earned in the profile

segment_hashstringrequired

Internal parameter

timestampintegerrequired

Response time in milliseconds, needs for resolve a race condition

custom_attributesarray of objectrequired

A maximum of 30 custom attributes to the profile are allowed to be set

keystringrequired

The key must be a string with no more than 30 characters. Only letters, numbers, dashes, points, and underscores allowed

valuestring | numberrequired

The attribute value must be no more than 50 characters. Only strings and floats are allowed as values

access_levelsarray of objectrequired

Array of Access level objects. Empty array if the customer has no access levels

access_level_idstring

Access level identifier

storestring

Store where the access level was purchased

store_product_idstring

Product ID in the store

store_base_plan_idstring

Base plan ID in the store

store_transaction_idstring

Transaction ID in the store

store_original_transaction_idstring

Original transaction ID in the store

offerallOf

Offer details, if a promotional or introductory offer was applied

categorystring

Offer category

One of: "introductory", "promotional", "offer_code", "win_back"

typestring

Offer type

One of: "free_trial", "pay_as_you_go", "pay_up_front"

idstring

Offer ID

starts_atstring

When the access level starts

purchased_atstring

When the access level was purchased

originally_purchased_atstring

When the access level was originally purchased

expires_atstring

When the access level expires

renewal_cancelled_atstring

When renewal was cancelled

billing_issue_detected_atstring

When billing issue was detected

is_in_grace_periodboolean

Whether the access level is in grace period

cancellation_reasonstring

Reason for cancellation

subscriptionsarray of objectrequired

Array of Subscription objects. Empty array if the customer has no subscriptions

storestring

Store where the subscription was purchased

store_product_idstring

Product ID in the store

store_base_plan_idstring

Base plan ID in the store

store_transaction_idstring

Transaction ID in the store

store_original_transaction_idstring

Original transaction ID in the store

offerallOf

Offer details, if a promotional or introductory offer was applied

categorystring

Offer category

One of: "introductory", "promotional", "offer_code", "win_back"

typestring

Offer type

One of: "free_trial", "pay_as_you_go", "pay_up_front"

idstring

Offer ID

environmentstring

Environment (Sandbox, Production)

purchased_atstring

When the subscription was purchased

originally_purchased_atstring

When the subscription was originally purchased

expires_atstring

When the subscription expires

renewal_cancelled_atstring

When renewal was cancelled

billing_issue_detected_atstring

When billing issue was detected

is_in_grace_periodboolean

Whether the subscription is in grace period

cancellation_reasonstring

Reason for cancellation

non_subscriptionsarray of objectrequired

Array of Non-Subscription objects. Empty array if the customer has no purchases

purchase_idstring

Unique purchase identifier

storestring

Store where the purchase was made

store_product_idstring

Product ID in the store

store_base_plan_idstring

Base plan ID in the store

store_transaction_idstring

Transaction ID in the store

store_original_transaction_idstring

Original transaction ID in the store

purchased_atstring

When the purchase was made

environmentstring

Environment (Sandbox, Production)

is_refundboolean

Whether this is a refund

is_consumableboolean

Whether this is a consumable purchase

Bad request

Schema
errorsarray of objectrequired
sourcestring

Source of the error

errorsarray of string

Array of error messages

error_codestringrequired

Short error name

status_codeintegerrequired

HTTP status code

Unauthorized

Schema
errorsarray of objectrequired
sourcestring

Source of the error

errorsarray of string

Array of error messages

error_codestringrequired

Short error name

status_codeintegerrequired

HTTP status code

Profile not found

Schema
errorsarray of objectrequired
sourcestring

Source of the error

errorsarray of string

Array of error messages

error_codestringrequired

Short error name

status_codeintegerrequired

HTTP status code

Internal server error