---
updatedAt: 2026-05-27T07:14:35.000Z
---

# Upload cost data

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "InCost API",
    "description": "InCost API, part of AppsFlyer ROI360, lets ad network partners programmatically send advertising cost data to AppsFlyer. Doing so provides advertisers with aggregate cost data from all their ad networks in one place.\n",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://hq1.appsflyer.com/api/"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/incost-uploader/v1/data/app/{app_id}": {
      "post": {
        "tags": [
          "InCost uploader"
        ],
        "summary": "Upload cost data",
        "operationId": "incost-uploader-post",
        "parameters": [
          {
            "name": "app_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "the app identifier as found in the AppsFlyer dashboard. Insert it exactly as it appears in the dashboard.\nEnsure to prefix iOS apps with **id**.\n",
            "example": "id123456789"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "$ref": "#/components/schemas/InCostData"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "InCost upload successful\n",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                },
                "examples": {
                  "Not found": {
                    "summary": "Not found",
                    "description": "Invalid json",
                    "value": "not-found"
                  }
                }
              }
            }
          },
          "415": {
            "description": "Media source not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "MediaSourceNotFound": {
                    "summary": "Media source not found",
                    "value": {
                      "error": {
                        "af_error_code": "ic213",
                        "error_message": "media_source was not found. Verify and resubmit."
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Incorrect JSON format",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "IncorrectJSONFormat": {
                    "summary": "Incorrect JSON format",
                    "value": {
                      "error": {
                        "af_error_code": "ic416",
                        "error_message": "Incorrect JSON format. Verify and resubmit."
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "To call the API, get the API V2 authorization token from your AppsFlyer admin. They can retrieve it from the AppsFlyer platform (HQ)\n"
      }
    },
    "schemas": {
      "Error": {
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "af_error_code": {
                "type": "string"
              },
              "error_message": {
                "type": "string"
              }
            }
          }
        }
      },
      "InCostData": {
        "type": "object",
        "required": [
          "date",
          "app_id",
          "media_source",
          "campaign_id",
          "campaign_name",
          "currency",
          "spend"
        ],
        "properties": {
          "date": {
            "type": "string",
            "description": "- Spend data\n- format: YYYY-MM-DD\n",
            "pattern": "^(20)\\d{2}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$",
            "example": "2019-12-30"
          },
          "app_id": {
            "type": "string",
            "maxLength": 250,
            "description": "- The app ID as it appears in the AppsFlyer platform\n- Format: String up to 250 characters  \n",
            "example": "id123456789"
          },
          "media_source": {
            "type": "string",
            "maxLength": 50,
            "description": "- Network name (ID) displaying the ad associated with your ad network partner account in AppsFlyer\n- Format: String 50 characters\n",
            "example": "network_int"
          },
          "af_prt": {
            "type": "string",
            "maxLength": 50,
            "description": "- Required for agency attribution and cost data.\n- Agency name as it displays on the attribution link and is associated with the agency account in AppsFlyer.\n- Format: String 50 characters\n",
            "example": "agencya"
          },
          "campaign_id": {
            "type": "string",
            "maxLength": 24,
            "description": "- Must be identical to the af_c_id param sent on the attribution link\n- Empty string not permitted\n- Format: String 24 characters\n"
          },
          "campaign_name": {
            "type": "string",
            "maxLength": 100,
            "description": "- Format: String 100 characters\n",
            "example": "my_campagin123"
          },
          "adset_id": {
            "type": "string",
            "maxLength": 24,
            "description": "- Required if you send adset_name \n- Must be identical to the af_adset_id param sent on the attribution link\n- If your cost reporting does not support adset_id, never send it\n- Format: String 24 characters\n",
            "example": "123A"
          },
          "adset_name": {
            "type": "string",
            "maxLength": 100,
            "description": "- If you send this field, you must also send adset_id\n- Format: String 100 characters\n",
            "example": "my_adset_name"
          },
          "ad_id": {
            "type": "string",
            "maxLength": 24,
            "description": "- Required if you send ad_name.\n- This field must be identical to the af_ad_id param sent on the attribution link\n- If your cost reporting does not support adset_id, never send it\n- Format: String 24 characters\n",
            "example": "123AB"
          },
          "site_id": {
            "type": "string",
            "maxLength": 24,
            "description": "- Unique ID that identifies the publisher that displays the ad.\n- Format: String 24 characters\n"
          },
          "ad_name": {
            "type": "string",
            "maxLength": 100,
            "description": "- If you send this field, you must also send `ad_id`.\n- Format: String 100 characters\n",
            "example": "Ad-name"
          },
          "geo": {
            "type": "string",
            "minItems": 0,
            "description": "- The country you recorded as associated with the cost\n- Where possible, this should represent the country where the ad was displayed\n- Format: ISO 3166 2 character country code\n",
            "enum": [
              "AF",
              "AX",
              "AL",
              "DZ",
              "AS",
              "AD",
              "AO",
              "AI",
              "AQ",
              "AG",
              "AR",
              "AM",
              "AW",
              "AU",
              "AT",
              "AZ",
              "BS",
              "BH",
              "BD",
              "BB",
              "BY",
              "BE",
              "BZ",
              "BJ",
              "BM",
              "BT",
              "BO",
              "BA",
              "BW",
              "BV",
              "BR",
              "IO",
              "BN",
              "BG",
              "BF",
              "BI",
              "KH",
              "CM",
              "CA",
              "CV",
              "KY",
              "CF",
              "TD",
              "CL",
              "CN",
              "CX",
              "CC",
              "CO",
              "KM",
              "CG",
              "CD",
              "CK",
              "CR",
              "CI",
              "HR",
              "CU",
              "CY",
              "CZ",
              "DK",
              "DJ",
              "DM",
              "DO",
              "EC",
              "EG",
              "SV",
              "GQ",
              "ER",
              "EE",
              "ET",
              "FK",
              "FO",
              "FJ",
              "FI",
              "FR",
              "GF",
              "PF",
              "TF",
              "GA",
              "GM",
              "GE",
              "DE",
              "GH",
              "GI",
              "GR",
              "GL",
              "GD",
              "GP",
              "GU",
              "GT",
              "GG",
              "GN",
              "GW",
              "GY",
              "HT",
              "HM",
              "VA",
              "HN",
              "HK",
              "HU",
              "IS",
              "IN",
              "ID",
              "IR",
              "IQ",
              "IE",
              "IM",
              "IL",
              "IT",
              "JM",
              "JP",
              "JE",
              "JO",
              "KZ",
              "KE",
              "KI",
              "KR",
              "KP",
              "KW",
              "KG",
              "LA",
              "LV",
              "LB",
              "LS",
              "LR",
              "LY",
              "LI",
              "LT",
              "LU",
              "MO",
              "MK",
              "MG",
              "MW",
              "MY",
              "MV",
              "ML",
              "MT",
              "MH",
              "MQ",
              "MR",
              "MU",
              "YT",
              "MX",
              "FM",
              "MD",
              "MC",
              "MN",
              "ME",
              "MS",
              "MA",
              "MZ",
              "MM",
              "NA",
              "NR",
              "NP",
              "NL",
              "AN",
              "NC",
              "NZ",
              "NI",
              "NE",
              "NG",
              "NU",
              "NF",
              "MP",
              "NO",
              "OM",
              "PK",
              "PW",
              "PS",
              "PA",
              "PG",
              "PY",
              "PE",
              "PH",
              "PN",
              "PL",
              "PT",
              "PR",
              "QA",
              "RE",
              "RO",
              "RU",
              "RW",
              "BL",
              "SH",
              "KN",
              "LC",
              "MF",
              "PM",
              "VC",
              "WS",
              "SM",
              "ST",
              "SA",
              "SN",
              "RS",
              "SC",
              "SL",
              "SG",
              "SK",
              "SI",
              "SB",
              "SO",
              "ZA",
              "GS",
              "ES",
              "LK",
              "SD",
              "SR",
              "SJ",
              "SZ",
              "SE",
              "CH",
              "SY",
              "TW",
              "TJ",
              "TZ",
              "TH",
              "TL",
              "TG",
              "TK",
              "TO",
              "TT",
              "TN",
              "TR",
              "TM",
              "TC",
              "TV",
              "UG",
              "UA",
              "AE",
              "GB",
              "US",
              "UM",
              "UY",
              "UZ",
              "VU",
              "VE",
              "VN",
              "VG",
              "VI",
              "WF",
              "EH",
              "YE",
              "ZM",
              "ZW"
            ]
          },
          "currency": {
            "type": "string",
            "minItems": 0,
            "description": "- Spend currency type\n- Format: ISO 4217 3-character currency code\n",
            "enum": [
              "USD",
              "AED",
              "AFN",
              "ALL",
              "AMD",
              "ANG",
              "AOA",
              "ARS",
              "AUD",
              "AWG",
              "AZN",
              "BAM",
              "BBD",
              "BDT",
              "BGN",
              "BHD",
              "BIF",
              "BMD",
              "BND",
              "BOB",
              "BRL",
              "BSD",
              "BTC",
              "BTN",
              "BWP",
              "BYN",
              "BZD",
              "CAD",
              "CDF",
              "CHF",
              "CLF",
              "CLP",
              "CNH",
              "CNY",
              "COP",
              "CRC",
              "CUC",
              "CUP",
              "CVE",
              "CZK",
              "DJF",
              "DKK",
              "DOP",
              "DZD",
              "EGP",
              "ERN",
              "ETB",
              "EUR",
              "FJD",
              "FKP",
              "GBP",
              "GEL",
              "GGP",
              "GHS",
              "GIP",
              "GMD",
              "GNF",
              "GTQ",
              "GYD",
              "HKD",
              "HNL",
              "HRK",
              "HTG",
              "HUF",
              "IDR",
              "ILS",
              "IMP",
              "INR",
              "IQD",
              "IRR",
              "ISK",
              "JEP",
              "JMD",
              "JOD",
              "JPY",
              "KES",
              "KGS",
              "KHR",
              "KMF",
              "KPW",
              "KRW",
              "KWD",
              "KYD",
              "KZT",
              "LAK",
              "LBP",
              "LKR",
              "LRD",
              "LSL",
              "LYD",
              "MAD",
              "MDL",
              "MGA",
              "MKD",
              "MMK",
              "MNT",
              "MOP",
              "MRO",
              "MRU",
              "MUR",
              "MVR",
              "MWK",
              "MXN",
              "MYR",
              "MZN",
              "NAD",
              "NGN",
              "NIO",
              "NOK",
              "NPR",
              "NZD",
              "OMR",
              "PAB",
              "PEN",
              "PGK",
              "PHP",
              "PKR",
              "PLN",
              "PYG",
              "QAR",
              "RON",
              "RSD",
              "RUB",
              "RWF",
              "SAR",
              "SBD",
              "SCR",
              "SDG",
              "SEK",
              "SGD",
              "SHP",
              "SLL",
              "SOS",
              "SRD",
              "SSP",
              "STD",
              "STN",
              "SVC",
              "SYP",
              "SZL",
              "THB",
              "TJS",
              "TMT",
              "TND",
              "TOP",
              "TRY",
              "TTD",
              "TWD",
              "TZS",
              "UAH",
              "UGX",
              "UYU",
              "UZS",
              "VEF",
              "VES",
              "VND",
              "VUV",
              "WST",
              "XAF",
              "XAG",
              "XAU",
              "XCD",
              "XDR",
              "XOF",
              "XPD",
              "XPF",
              "XPT",
              "YER",
              "ZAR",
              "ZMW",
              "ZWL",
              "BYR"
            ]
          },
          "spend": {
            "type": "integer",
            "format": "double",
            "pattern": "^\\d+(\\.\\d{1,5})?$",
            "description": "- Spend amount using the specified currency \n- Five digits allowed after the decimal point\n- The value 0 (zero) is permitted\n- Negative values are NOT permitted\n- Don't send , delimiters\n- Don't send values in quotation marks. \n- Format: Decimal number\n"
          },
          "channel": {
            "type": "string",
            "maxLength": 20,
            "description": "- Must be identical to the `af_channel` param sent on the attribution link.\n- Format: String 20 characters\n",
            "example": "my_channel"
          },
          "keywords": {
            "type": "string",
            "maxLength": 100,
            "description": "- Format: String 100 characters\n",
            "example": "abc app"
          }
        }
      }
    }
  }
}
```