Skip to main content
POST
https://api.bit2connect.com
/
1.0
/
links
curl -X POST "https://api.bit2connect.com/1.0/links" \
  -H "X-API-KEY: b2co_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "summer-sale",
    "name": "Summer Sale Campaign",
    "payload": {
      "link": "https://yourapp.com/products/summer-sale",
      "android": {
        "package": "com.yourapp.android",
        "store_fallback": "https://play.google.com/store/apps/details?id=com.yourapp.android"
      },
      "ios": {
        "bundleId": "com.yourapp.ios",
        "app_store_fallback": "https://apps.apple.com/app/yourapp/id123456789"
      },
      "social": {
        "title": "Summer Sale - Up to 50% Off!",
        "description": "Don'\''t miss our biggest sale of the year. Shop now!",
        "image": "https://yourapp.com/images/summer-sale.jpg"
      },
      "campaign": {
        "utm_source": "api",
        "utm_medium": "dynamic_link",
        "utm_campaign": "summer_sale_2024"
      }
    },
    "expiresAt": "2024-12-31T23:59:59Z"
  }'
{
  "success": true,
  "data": {
    "id": "clp123abc456",
    "code": "summer-sale",
    "shortUrl": "https://b2co.link/summer-sale",
    "originalUrl": "https://yourapp.com/products/summer-sale",
    "name": "Summer Sale Campaign",
    "status": "ACTIVE",
    "qrCode": "https://b2co.link/summer-sale/qr",
    "createdAt": "2024-01-15T10:30:00Z",
    "expiresAt": "2024-12-31T23:59:59Z",
    "clickCount": 0
  }
}

Request

X-API-KEY
string
required
Your API key: b2co_your_api_key
code
string
Custom short code for the link. If not provided, a random code will be generated. Must be unique within your project and contain only alphanumeric characters, hyphens, and underscores (3-50 characters).
Link Codes are Unique: Each link code must be unique within your project. Use the Check Code Availability endpoint to verify if a code is available before creating a link.
name
string
Optional display name for the link to help with organization and identification.
payload
object
required
Link configuration object containing destination URL and platform-specific settings.
The destination URL where users will be redirected when they click the dynamic link.
payload.iosAppId
string
ID of a saved iOS mobile app to use for this link. When provided, the link will use the saved app’s configuration instead of manual iOS settings.
payload.androidAppId
string
ID of a saved Android mobile app to use for this link. When provided, the link will use the saved app’s configuration instead of manual Android settings.
payload.android
object
Android-specific configuration for deep linking and app store fallbacks.
payload.android.package
string
Android app package name (e.g., com.yourapp.android).
payload.android.store_fallback
string
Play Store URL to redirect Android users without the app.
payload.android.min_version
string
Minimum app version required to handle the deep link.
payload.android.saveApp
boolean
Whether to save this Android configuration as a reusable mobile app.
payload.android.appName
string
Name for the saved mobile app (required if saveApp is true).
payload.ios
object
iOS-specific configuration for deep linking and App Store fallbacks.
payload.ios.bundleId
string
iOS app bundle identifier (e.g., com.yourapp.ios).
payload.ios.app_store_fallback
string
App Store URL to redirect iOS users without the app.
payload.ios.app_store_id
string
App Store ID for the iOS app.
payload.ios.min_version
string
Minimum app version required to handle the deep link.
payload.ios.saveApp
boolean
Whether to save this iOS configuration as a reusable mobile app.
payload.ios.appName
string
Name for the saved mobile app (required if saveApp is true).
payload.social
object
Social media preview configuration for rich link sharing.
payload.social.title
string
Title displayed in social media previews.
payload.social.description
string
Description displayed in social media previews.
payload.social.image
string
Image URL displayed in social media previews.
payload.campaign
object
UTM campaign parameters for analytics tracking.
payload.campaign.utm_source
string
Campaign source parameter.
payload.campaign.utm_medium
string
Campaign medium parameter.
payload.campaign.utm_campaign
string
Campaign name parameter.
payload.campaign.utm_term
string
Campaign term parameter (for paid search keywords).
payload.campaign.utm_content
string
Campaign content parameter (for A/B testing and content-targeted ads).
payload.desktop_fallback
string
Fallback URL for desktop users.
expiresAt
string
Optional expiration date in ISO 8601 format. Link will become inactive after this date.

Response

success
boolean
Indicates if the request was successful
data
object
The created link object
data.id
string
Unique identifier for the link
data.code
string
The unique short code for the link
data.shortUrl
string
The complete short URL that can be shared
data.originalUrl
string
The original destination URL
data.name
string
Display name of the link
data.status
string
Current status of the link (ACTIVE, PAUSED, etc.)
data.qrCode
string
QR code URL for the link
data.createdAt
string
ISO 8601 timestamp when the link was created
data.expiresAt
string
ISO 8601 timestamp when the link expires (if set)
data.clickCount
number
Number of times the link has been clicked
curl -X POST "https://api.bit2connect.com/1.0/links" \
  -H "X-API-KEY: b2co_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "summer-sale",
    "name": "Summer Sale Campaign",
    "payload": {
      "link": "https://yourapp.com/products/summer-sale",
      "android": {
        "package": "com.yourapp.android",
        "store_fallback": "https://play.google.com/store/apps/details?id=com.yourapp.android"
      },
      "ios": {
        "bundleId": "com.yourapp.ios",
        "app_store_fallback": "https://apps.apple.com/app/yourapp/id123456789"
      },
      "social": {
        "title": "Summer Sale - Up to 50% Off!",
        "description": "Don'\''t miss our biggest sale of the year. Shop now!",
        "image": "https://yourapp.com/images/summer-sale.jpg"
      },
      "campaign": {
        "utm_source": "api",
        "utm_medium": "dynamic_link",
        "utm_campaign": "summer_sale_2024"
      }
    },
    "expiresAt": "2024-12-31T23:59:59Z"
  }'
{
  "success": true,
  "data": {
    "id": "clp123abc456",
    "code": "summer-sale",
    "shortUrl": "https://b2co.link/summer-sale",
    "originalUrl": "https://yourapp.com/products/summer-sale",
    "name": "Summer Sale Campaign",
    "status": "ACTIVE",
    "qrCode": "https://b2co.link/summer-sale/qr",
    "createdAt": "2024-01-15T10:30:00Z",
    "expiresAt": "2024-12-31T23:59:59Z",
    "clickCount": 0
  }
}

Error Codes

VALIDATION_ERROR
string
Invalid request payload or parameters
CODE_ALREADY_EXISTS
string
The specified code is already in use
INVALID_API_KEY
string
API key is missing or invalid
RATE_LIMIT_EXCEEDED
string
Too many requests, please try again later
SUBSCRIPTION_REQUIRED
string
Active subscription required to create links