---
title: (Triple ID) Generate an affiliate link
slug: mihai-tests/triple-id-generate-an-affiliate-link
createdAt: 2025-05-02T10:16:35.476Z
---

{
  "id": "yYs0HK1LVLDLH_FInlQJO",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.sandbox.tripleup.dev/triple-id-affiliate-link-api",
    "servers": [
      {
        "url": "https://api.sandbox.tripleup.dev/triple-id-affiliate-link-api",
        "description": "triple Sandbox"
      }
    ],
    "name": "(Triple ID) Generate an affiliate link",
    "description": "<p>Generate a link for an (online) affiliate Offer. The link is specific to a single Card Account (cardholder), in order to attribute the purchase to the correct account. This endpoint requires the use of a triple generated cardholder ID.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "",
          "customType": "TripleLinkRequestBody",
          "schema": [
            {
              "name": "card_account_id",
              "kind": "required",
              "type": "string",
              "description": "Triple-defined Card Accound ID. Triple card_account_id must exist for the specified program.\n",
              "example": ""
            },
            {
              "name": "offer_id",
              "kind": "required",
              "type": "string",
              "description": "Triple Offer ID, provided by the API or offers file.",
              "example": ""
            },
            {
              "name": "publisher_external_id",
              "kind": "optional",
              "type": "string",
              "description": "The partner-defined, external Publisher ID. <em>Required for Portfolio Managers.</em>\n",
              "example": ""
            }
          ],
          "modelRef": "#/components/schemas/TripleLinkRequestBody",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "OK",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"url\":\"https://example.com/affiliate-link-consumer?id=long-unique-id\"}",
            "description": "",
            "customType": "AffiliateSuccess",
            "schema": [
              {
                "name": "url",
                "kind": "optional",
                "type": "string",
                "description": "A URL for a link for the consumer",
                "example": ""
              }
            ],
            "modelRef": "#/components/schemas/AffiliateSuccess",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Bad request",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "401",
        "description": "Unauthorized",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "404",
        "description": "Merchant not found",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"message\":\"merchant_id AcmeWidgets does not exist.\"}",
            "description": "",
            "customType": "AffiliateFailure",
            "schema": [
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "A description of the failure.",
                "example": ""
              }
            ],
            "modelRef": "#/components/schemas/AffiliateFailure",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "500",
        "description": "Internal server error",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "example-0-curl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.sandbox.tripleup.dev/triple-id-affiliate-link-api \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"card_account_id\": \"\",\n     \"offer_id\": \"\"\n     }'"
        },
        {
          "id": "example-1-javascript",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"card_account_id\": \"\",\n   \"offer_id\": \"\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.sandbox.tripleup.dev/triple-id-affiliate-link-api\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "example-2-ruby",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.sandbox.tripleup.dev/triple-id-affiliate-link-api\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"card_account_id\": \"\",\n   \"offer_id\": \"\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "example-3-python",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.sandbox.tripleup.dev/triple-id-affiliate-link-api\"\n\npayload = json.dumps({\n   \"card_account_id\": \"\",\n   \"offer_id\": \"\"\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "example-0-curl"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// OK\n{\n  \"url\": \"\"\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad request\n"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Unauthorized\n"
        },
        {
          "id": "response-3-404",
          "language": "404",
          "code": "// Merchant not found\n{\n  \"message\": \"\"\n}"
        },
        {
          "id": "response-4-500",
          "language": "500",
          "code": "// Internal server error\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "id": "ElpoDFGhhfAt6tD6BqcAy",
      "type": "paragraph",
      "children": [
        {
          "text": "Generate a link for an (online) affiliate Offer. The link is specific to a single Card Account (cardholder), in order to attribute the purchase to the correct account. This endpoint requires the use of a triple generated cardholder ID."
        }
      ]
    }
  ]
}