---
title: endpoint for delivering conversion events and associated data back to the tracking infrastructure
slug: fluid-adserver-api/endpoint-for-delivering-conversion-events-and-associated-data-back-to-the-tracking-infrastructure
docTags: 
createdAt: 2024-05-16T12:14:49.139Z
---

{
  "id": "de1AqzgiUZkao5vBxgdQf",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://localhost/conversion",
    "servers": [
      {
        "url": "https://localhost/conversion"
      }
    ],
    "name": "endpoint for delivering conversion events and associated data back to the tracking infrastructure",
    "description": "<p>This endpoint should be used by publishers to track product purchases that are advertised by Fluid Ads\nplatform. Those tracked purchases are evaluated for possible attribution to Fluid ads sponsoring, i.e. to decide\nwhether they happened due sponsoring the product by the platform.</p>\n<p>Note: the conversion request should be sent by the publisher's backend system, and not by the end user's browser/interface.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "",
          "customType": "Conversion",
          "schema": [
            {
              "name": "user_id",
              "kind": "required",
              "type": "string",
              "description": "Unique identifier for the end user that's fixed and consistent across publisher sites and client devices. It must be same as the one provided in the ad request.\n\nValidation Rules:\n- maxLength: 128\n",
              "example": ""
            },
            {
              "name": "user_logged_in_id",
              "kind": "optional",
              "type": "string",
              "description": "[Optional] A persistent user ID for logged in users/customers\n\nValidation Rules:\n- minLength: 1\n- maxLength: 128\n",
              "example": ""
            },
            {
              "name": "transaction_id",
              "kind": "required",
              "type": "string",
              "description": "Unique identifier for this transaction.\n\nValidation Rules:\n- maxLength: 64\n",
              "example": ""
            },
            {
              "name": "site_id",
              "kind": "required",
              "type": "integer<int32>",
              "description": "Fluid ads publisher manager site id for the site where the purchase happened, e.g. the desktop site, or mobile site.",
              "example": 0
            },
            {
              "name": "publisher_id",
              "kind": "required",
              "type": "integer<int32>",
              "description": "Fluid ads publisher manager publisher id. Note that this is the integer publisher id, and not the publisher UUID.",
              "example": 0
            },
            {
              "name": "currency",
              "kind": "required",
              "type": "string",
              "description": "Currency code as specified by ISO 4217.\n\nValidation Rules:\n- maxLength: 3\n",
              "example": "USD"
            },
            {
              "name": "products",
              "kind": "required",
              "type": "array",
              "description": "Purchased products\n\nValidation Rules:\n- minItems: 1\n",
              "modelRef": "#/components/schemas/Product",
              "customType": "Product[]",
              "schema": [
                {
                  "name": "gtin",
                  "kind": "required",
                  "type": "string",
                  "description": "Validation Rules:\n- maxLength: 60\n",
                  "example": ""
                },
                {
                  "name": "group_id",
                  "kind": "optional",
                  "type": "string",
                  "description": "The product group id which can be used in in-group attribution, e.g. attributing a \"red pen\" purchase through \"blue pen\" click.\n\nValidation Rules:\n- maxLength: 60\n",
                  "example": ""
                },
                {
                  "name": "brand",
                  "kind": "optional",
                  "type": "string",
                  "description": "Validation Rules:\n- maxLength: 128\n",
                  "example": ""
                },
                {
                  "name": "price",
                  "kind": "required",
                  "type": "number<double>",
                  "description": "The product unit price.",
                  "example": ""
                },
                {
                  "name": "quantity",
                  "kind": "required",
                  "type": "integer<int32>",
                  "description": "The number of sold items.",
                  "example": 0
                }
              ]
            }
          ],
          "modelRef": "#/components/schemas/Conversion",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "OK",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "400",
        "description": "Request payload does not comply to the conversion json schema.",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "FwmWxjqtUWy-hQG9ksfj4",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://localhost/conversion \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"user_id\": \"\",\n     \"transaction_id\": \"\",\n     \"site_id\": 0,\n     \"publisher_id\": 0,\n     \"currency\": \"USD\",\n     \"products\": [\n     {\n     \"gtin\": \"\",\n     \"price\": \"\",\n     \"quantity\": 0\n     }\n     ]\n     }'"
        },
        {
          "id": "XQpxGo1Gi237xbUxi7UbT",
          "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   \"user_id\": \"\",\n   \"transaction_id\": \"\",\n   \"site_id\": 0,\n   \"publisher_id\": 0,\n   \"currency\": \"USD\",\n   \"products\": [\n      {\n         \"gtin\": \"\",\n         \"price\": \"\",\n         \"quantity\": 0\n      }\n   ]\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://localhost/conversion\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "tFyun6_ORfjEB7OkF7PG9",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://localhost/conversion\")\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   \"user_id\": \"\",\n   \"transaction_id\": \"\",\n   \"site_id\": 0,\n   \"publisher_id\": 0,\n   \"currency\": \"USD\",\n   \"products\": [\n      {\n         \"gtin\": \"\",\n         \"price\": \"\",\n         \"quantity\": 0\n      }\n   ]\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "eU4GvzYxbABa43mNzsctc",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://localhost/conversion\"\n\npayload = json.dumps({\n   \"user_id\": \"\",\n   \"transaction_id\": \"\",\n   \"site_id\": 0,\n   \"publisher_id\": 0,\n   \"currency\": \"USD\",\n   \"products\": [\n      {\n         \"gtin\": \"\",\n         \"price\": \"\",\n         \"quantity\": 0\n      }\n   ]\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": "FwmWxjqtUWy-hQG9ksfj4"
    },
    "results": {
      "languages": [
        {
          "id": "MzG27OEqCs95w6QTae1ZX",
          "language": "200",
          "code": "// OK\n"
        },
        {
          "id": "lRiwrR2P3b85BCgOd13Qi",
          "language": "400",
          "code": "// Request payload does not comply to the conversion json schema.\n"
        }
      ],
      "selectedLanguageId": "MzG27OEqCs95w6QTae1ZX"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}