Product Feed Import (Mutation)

This feature is currently available for Shopping and Finance feeds only, and allows Advertisers to import product feed data into CJ.

Advertisers can perform mutations to create new products, modify existing products, and remove products from their CJ Product Feeds via the API. This is especially useful for advertisers who make frequent updates to their product catalogs in smaller volumes and can avoid sending full product feeds each time.

📋Before You Implement
  • Personal Access Token: You will need to create a Personal Access Token on the CJ Developer Portal. If you already use a CJ personal access token for authentication, a new token does not need to be created.
  • CompanyId: You will need your CJ-provided companyId (CID) to ensure you have the permission to query on behalf of that company account.

Retail Vertical

GraphQL Mutations

mutation {
  createShoppingProducts(
    adId: "12345678"
    shoppingProducts: [
      {
        id: "P11"
        title: "New Earpods"
        description: "Noise cancellation enabled earpods"
        price: {
          amount: "111.5"
          currency: "USD"
        }
        availability: "in stock"
        condition: "Used"
        link: "https://test.cj.com"
      }
    ]
  ) {
    response {
      id
      title
      price { amount }
    }
    errors {
      id
      field
      messages
      warnings
      originalValue
    }
  }
}
mutation {
  updateShoppingProducts(
    adId: "12345678"
    shoppingProducts: [
      {
        id: "P12"
        title: "Green earpods"
        description: "Noise cancellation enabled"
        price: {
          amount: "100"
          currency: "USD"
        }
      }
    ]
  ) {
    response {
      id
      title
      description
      price { amount currency }
    }
    errors { id field messages warnings }
  }
}
mutation {
    deleteProducts(
        adId: 12345678, 
        ids: ["20245", "20192"]
    ) {
        deleteProductsResponse {
            id
            messages
        }
        errors {
            id
            field
            messages
            warnings
            originalValue
        }
    }
}

cURL requests

curl 'https://ads.api.cj.com/query' \
  -X POST \
  -H 'Authorization: Bearer <your-personal-access-token>' \
  -d '{"query":"mutation { createShoppingProducts(adId: \"12345678\", shoppingProducts: [{id: \"P11\", title: \"New Earpods\", description: \"Noise cancellation enabled earpods\", price: {amount: \"111.5\", currency: \"USD\"}, availability: \"in stock\", condition: \"Used\", link: \"http://test.cj.com\"}]) { response { id title price{ amount } } errors { id field messages warnings originalValue } } } "}'
curl 'https://ads.api.cj.com/query' \
  -X POST \
  -H 'Authorization: Bearer <your-personal-access-token>' \
  -d '{"query":"mutation {updateShoppingProducts ( adId: \"12345678\", shoppingProducts:[{id: \"P12\", title:\"Green earpods\", description:\"Noise cancellation enabled\" price: { amount:\"100\", currency:\"USD\" }}]) { response { price { amount currency } id description title } errors { id field messages warnings }}}"}'
curl 'https://ads.api.cj.com/query' \
  -X POST \
  -H 'Authorization: Bearer <your-personal-access-token>' \
  -d '{"query":"mutation { deleteProducts(adId:12345678,ids:[\"20245\",\"20192\",\"jahsdjk\"]){ deleteProductsResponse{ id messages } errors{ id field messages warnings originalValue }}}" }'

JSON responses

{
  "data": {
    "createShoppingProducts": {
      "response": [
        { "id": "P11", "title": "New Earpods", "price": { "amount": "111.5" } }
      ],
      "errors": []
    }
  }
}
{
  "data":
  {
    "updateShoppingProducts": {
      "response": [
      {
        "description":"Noise cancellation enabled", 
        "price":{
          "amount":"100",
          "currency":"USD"
        },
        "id":"P12",
        "title":"Green earpods"
      }
    ], 
      "errors":[]
    }
  }
}
{
  "data": {
    "deleteProducts": {
      "deleteProductsResponse": [
        {
          "id": [
            "20245"
          ],
          "messages": [
            "Successfully deleted"
          ]
        },
        {
          "id": [
            "20192"
          ],
          "messages": [
            "Successfully deleted"
          ]
        }
      ],
      "errors": [ ]
    }
  }
}

Finance Vertical

GraphQL Mutations

mutation {
  createCreditCardProducts(
    adId: "12345678"
    creditCardProducts: [
      {
        id: "A1"
        title: "CJ Rate Advantage Master Platinum Card"
        imageLink: "https://cj.com"
        description: "CJ Rate Advantage Master Platinum Card"
        destinationUrl: "https://cj.com"
        creditRating: "Good - Excellent"
        processingNetwork: "Visa"
        availableApplications: "Internet, Mobile"
        nonIntroPurchAPR: {
          aprValue: ["25.40"]
          aprType: FIXED
          aprDescription: "25.40% Fixed"
        }
        nonIntroTransAPR: {
          aprValue: ["9.40", "22.40"]
          aprType: VARIABLE
          aprDescription: "9.40% - 22.40% Variable"
        }
        balanceTransFee: {
          feeValueAmount: { amount: "10.0", currency: "USD" }
          feeDescription: "$10 balance transfers and cash advances"
        }
      }
    ]
  ) {
    response { id title }
    errors { id field warnings messages }
  }
}
mutation {
  updateCreditCardProducts(
    adId: "12345678"
    creditCardProducts: [
      {
        id: "A1"
        nonIntroPurchAPR: {
          aprValue: ["13.40"]
          aprType: FIXED
          aprDescription: "26.40% Fixed"
        }
        nonIntroTransAPR: {
          aprValue: ["10", "20"]
          aprType: VARIABLE
          aprDescription: "9.40% - 22.40% Variable"
        }
      }
    ]
  ) {
    response {
      id
      nonIntroPurchAPR { aprValue }
      nonIntroTransAPR { aprValue }
    }
    errors { id field warnings messages }
  }
}
mutation {
  deleteProducts(
    adId: 12345678
    ids: ["20245", "20192"]
  ) {
    deleteProductsResponse { id messages }
    errors { id field messages warnings originalValue }
  }
}

cURL requests

curl 'https://ads.api.cj.com/query' \
 -X POST \
 -H 'Authorization: Bearer <your-personal-access-token>' \
 -d '{"query":"mutation { createCreditCardProducts( adId: \"12345678\" creditCardProducts: [ { id: \"A1\" title: \"CJ&reg; Rate Advantage Master Visa Platinum&reg; Card\" imageLink: \"https://cj.com\" description: \"CJ Rate Advantage Master Visa Platinum&reg; Cardⓒ\" destinationUrl: \"https://cj.com\" creditRating: \"Good - Excellent\" processingNetwork: \"Visa\" marketingCopy: \"&#8226; Enjoy CJ'\''s lowest rate card &#8226; No annual fee, no penalty APR &#8226; CJ membership is available to active and former military and their eligible family membersⓒ\" availableApplications: \"Internet, Mobile\" nonIntroPurchAPR: { aprValue: [\"25.40\"] aprType: FIXED aprDescription: \"25.40% Fixed\" } nonIntroTransAPR: { aprValue: [\"9.40\", \"22.40\"] aprType: VARIABLE aprDescription: \"9.40% - 22.40% Variable\" } balanceTransFee: { feeValueAmount: { amount: \"10.0\", currency: \"USD\" } feeDescription: \"$10 balance transfers and cash advances\" } } ] ) { response { id title } errors { id field warnings messages } } }"}'
curl 'https://ads.api.cj.com/query' \
  -X POST \
  -H 'Authorization: Bearer <your-personal-access-token>' \
  -d '{"query":"mutation { updateCreditCardProducts( adId: \"12345678\" creditCardProducts: [ { id: \"A1\" nonIntroPurchAPR: { aprValue: [\"13.40\"] aprType: FIXED aprDescription: \"26.40% Fixed\" } nonIntroTransAPR: { aprValue: [\"10\", \"20\"] aprType: VARIABLE aprDescription: \"9.40% - 22.40% Variable\" } } ] ) { response { id nonIntroTransAPR{ aprValue } nonIntroPurchAPR{ aprValue } } errors { id field warnings messages } } }"}'
curl 'https://ads.api.cj.com/query' \
  -X POST \
  -H 'Authorization: Bearer <your-personal-access-token>' \
  -d '{"query":"mutation { deleteProducts(adId:12345678,ids:[\"20245\",\"20192\",\"jahsdjk\"]){ deleteProductsResponse{ id messages } errors{ id field messages warnings originalValue }}}" }'

JSON responses

{
  "data": {
    "createCreditCardProducts": {
      "response": [
        {
          "id": "A1",
          "title": "CJ&reg; Rate Advantage Master Platinum&reg; Card"
        }
      ],
      "errors": []
    }
  }
}
{
  "data": {
    "updateCreditCardProducts": {
      "response": [
        {
          "id": "2",
          "nonIntroTransAPR": {
            "aprValue": [
              "[10, 20]"
            ]
          },
          "nonIntroPurchAPR": {
            "aprValue": [
              "[13.40]"
            ]
          }
        }
      ],
      "errors": []
    }
  }
}
{
  "data": {
    "deleteProducts": {
      "deleteProductsResponse": [
        {
          "id": [
            "20245"
          ],
          "messages": [
            "Successfully deleted"
          ]
        },
        {
          "id": [
            "20192"
          ],
          "messages": [
            "Successfully deleted"
          ]
        }
      ],
      "errors": [ ]
    }
  }
}
🚧
  • Limit the request to max 1,000 products in 1 request to get a good response time of 1-2 seconds
  • Any volume of data higher than 1,000 should be broken down in chunks of 1000 products as multiple API requests to get a timely response
  • Call limit: 500 calls per 5 minutes.

FAQ

I have never sent a shopping feed file to CJ. Can I use the API to start sending the product feed for the first time

Yes. If you have not registered a shopping feed before, then you need to register a new feed with an API delivery option and use the newly created Ad Id in the API. To register a new feed go to Campaigns> Ad Assets> Product Feeds in CJ Account Manager.

Is it mandatory to switch to this API from product feed files?

No. CJ Product Import API provides a faster & modernized way to send product feed data and it is optional for advertisers to utilize this benefit to send product feeds.

What do I need to start using the API to send products?

Personal Access Token and Ad ID

Should I register a new feed to use the API?

If you have been previously sending in a file and want to either switch to the API or use both file and API, then you don't need to register a new feed to use the API. You can use the existing Ad ID of the CJ Shopping Feed.

Where can I see my existing feed Ad ID?

CJ Account Campaigns> Ad Assets> Product Feeds

Will my Shopping Product API updates be visible in my product feed within CJ Account Manager?

Updates to your Shopping Products will be visible in CJ Account Manager under Campaigns > Ad Assets >Products within few seconds after you receive a successful API response.

Will my Finance Product API updates be visible in my product feed within CJ Account Manager?

The information on your Finance Product Feeds will not be visible in the CJ Account Manager.

When should I use Product feed file versus Product Import via API?
  • APIs and Product feed files are both effective ways to send the product data to CJ depending on your product feed volume.
  • If you have a low volume product feed, you can use the API for the first time import as well as subsequent imports with delta.
  • If you have a high-volume product feed updated frequently, we recommend you import the full product file first time through batch. Subsequent updates for the feed can be sent only via API.
Will my publishers be able to see the newly added products or updates to existing products?

Today, CJ Publishers can view the product feed information through multiple channels. Changes made to a Product Feed are visible on the CJ Account Manager , CJ Product Search API as well as Publisher Product Export feeds.

Can I use the API for building custom applications?

Yes, integrating systems across businesses is a key benefit of any API. You can use the API to integrate with your internal product systems and automate the feed transfer process.

What happens if I use both Batch files and APIs?

We do not recommend using both the methods simultaneously as it may overwrite the feed data.

How many products can I send in one API request?

Please refer to section - Mutation Usage Caps/Limits to get the fastest API response.

Errors

  • Authentication/Authorization Errors
    • Please make sure you are including your valid Personal Access Token.
    • Please make sure you provide the correct CJ Shopping feed AID as an argument in the API request. We use this ad id to verify that the personal access token belongs to a user on the advertiser account and that you are authorized to make updates to the ad id/feed.
  • Query Parsing Errors
    • Feel free to use the GraphiQL App to test out your queries.
    • Just go to https://ads.api.cj.com/ in your browser. Don't forget your Personal Access Token in the top left corner.

What’s Next