Overview

Prerequisites

Authentication token. Learn how to obtain the API token.


Create OneLink attribution link


Endpoint


POST https://onelink.appsflyer.com/shortlink/v1/{onelink-id}&id={id}

Path parameters


ParameterData TypeDescriptionExample
onelink-id*stringThe link template ID.A1b3

Query parameters


ParameterData TypeDescriptionExample
idstringThe ID of the created short link. When the ID is not provided in the request, a random ID is generated.my_shortlink_id

Body parameters


NameTypeDescriptionExample
brand_domainstringOnly use this param and request it in the payload if:
1) The Branded Links feature is enabled in your account.
2) The branded link is configured in your account.

If these conditions are not met, do not use this parameter, as the API call will not work.
mybranded.com
ttlstringTime to Live for the full attribution link. The default is 31 days. The value can be specified in days (default), minutes, or hours (for example, 10m, 20h, 14d).25d
data*JSONJSON format of the query parameters following the AppsFlyer macros for attribution links.

Note: The media source (pid) parameter is mandatory.
'{"pid": "my_media_source_SMS", "c": "my_campaign" }'



Get OneLink attribution link


Endpoint

GET https://onelink.appsflyer.com/shortlink/v1/{onelink-id}&id={id}

Path parameters

ParameterData TypeDescriptionExample
onelink-id*stringThe link template ID.A1b3

ParameterData TypeDescriptionExample
idstringThe ID of the short OneLink query params. For example, for the following OneLink attribution link: myapp.onelink.me/abc123/qwer9876, the shortlink-id is qwer9876my_shortlink_id



Update OneLink attribution link


Endpoint

PUT https://onelink.appsflyer.com/shortlink/v1/{onelink-id}&id={id}

Path parameters

ParameterData TypeDescriptionExample
onelink-id*stringThe link template ID.A1b3

ParameterData TypeDescriptionExample
id*stringThe ID of the short OneLink. For example, for the following OneLink attribution link: myapp.onelink.me/abc123/qwer9876, the shortlink-id is qwer9876my_shortlink_id

NameTypeDescriptionExample
brand_domainstringOnly use this param and request it in the payload if:
1) The Branded Links feature is enabled in your account.
2) The branded link is configured in your account.

If these conditions are not met, do not use this parameter, as the API call will not work.
mybranded.com
ttlstringTime to Live for the full attribution link. The default is 31 days. The value can be specified in days (default),



Delete OneLink attribution link


Endpoint

DELETE https://onelink.appsflyer.com/shortlink/v1/{onelink-id}&id={id}

Path parameters

ParameterData TypeDescriptionExample
onelink-id*stringThe link template ID.A1b3

Query parameters

ParameterData TypeDescriptionExample
id*stringThe ID of the short OneLink to be deleted. For example, for the following OneLink attribution link: myapp.onelink.me/abc123/qwer9876, the ID is qwer9876my_shortlink_id




API Limitations

LimitsRemarks
API quota limit• The limit for using the OneLink API to create, edit, or delete OneLink links is 7.5 million per month (UTC timezone), per account.
• All requests that are made after exceeding this quota are not served, and the links are not created; the API call receives error status code 429 with the message "Monthly quota exceeded".
• Information regarding how much of the rate quota is used/remains is displayed in the OneLink API dashboard.
Rate limit• The API rate limit per account is 500 requests per second (30000 per minute).
• All requests that are made exceeding 500 requests per second (30000 per minute) are not served, and the links are not created; the API call receives error status code 429 with the message "Rate limit exceeded".
Link visibility• Links created via the API do not appear in the list of OneLink custom links in the AppsFlyer dashboard.
• Best practice: Save API-created links to a local table, so you can access the links for any future purpose.
TTL• The default time to live (TTL) for OneLink short URLs created via OneLink API is 31 days. It's extended by 31 days each time the link is clicked. Clicking on a link once the TTL expires still defaults to the behavior defined in the OneLink base configuration, but the attribution will not work.
• It can take up to 48 hours for a OneLink short URL to be deleted after the TTL expires.
• Maximum TTL is 31 days. Any TTL value larger than 31 is overridden with the default TTL of 31.
• You can change the default TTL by adding the parameter ttl={value} and specifying how many days, hours, or minutes. For example ttl=7d, ttl=12h, or ttl=10m.
• You can send an update request to specify the TTL. Any update request resets the TTL (for existing links) to the one specified in the request body.
• If you don't want link TTLs to automatically extend, add the parameter renew_ttl=false to your links. The value for this parameter is boolean, either true (default) or false.
Special charactersThe following characters must be encoded if used for API created links: ;, *, !, @, #, ?, $, ^, :, &, ~, `, =, +, ’, >, <, /If you don't encode these characters, they are replaced with a blank space, and the link and its functionality could potentially break.
PayloadQuery string from the payload can't exceed 2,048 characters.
URL IDThe URL ID (or shortlink ID) can be edited to highlight your campaign offering. For example: https://myapp.onelink.me/abc123/**apples. The URL ID must not exceed 50 characters and can be a combination of letters and numbers. By default, it is 8 characters.
Note:**
• You can only edit the URL ID if the current ID isn't already in use.
• If the URL ID is already in use, link creation fails and returns an error response (400). You and your developer need to decide and configure what happens in such an event.
• The failed call still counts toward your monthly API quota.