Sources represent the origin of your product data. They can be various platforms or systems from which you retrieve product information, including affiliate networks.

Types of Sources

Sources can include, but are not limited to:

  • E-commerce platforms (Shopify)
  • Affiliate networks (CJ, Awin, Impact.com, Partnerize, ShareASale, Rakuten)
  • Custom data feeds or APIs

The full list of supported source types is defined in the SourceType enum.

Source Operations

Query: getSources

Retrieves all registered sources.

getSources: [SourceSchema!]

This query returns an array of SourceSchema objects.

Example:

query {
  getSources {
    id
    name
    type
    url
    description
    sourceHeaders
    sourceBody
    sourceMethod
    jobs {
      id
      status
    }
  }
}

Response:

{
  "data": {
    "getSources": [
      {
        "id": "12",
        "name": "My Shopify Store",
        "type": "Shopify",
        "url": "https://mystore.myshopify.com/",
        "jobs": [
          {
            "id": "543",
            "status": "Live"
          }
        ]
      },
      {
        "id": "13",
        "name": "Vestiare Collective",
        "type": "CJ",
        "description": "US Feed, 4564341 products",
        "jobs": []
      },
      {
        "id": "14",
        "name": "Ruggable Google Feed",
        "type": "Request",
        "url": "https://ruggable.com/feed/google",
        "sourceHeaders": ["Authorization: Bearer ${RUGGABLE_API_KEY}"], // the RUGGABLE_API_KEY credential was submitted in the credentials field on saving and cannot be retrieved 
        "jobs": []
      }
    ]
  }
}

Mutation: saveSource

Saves a new data source, including affiliate networks.

saveSource(source: SourceRequest!, targetFormat: JSON!): ID!

This mutation takes a SourceRequest input and returns the ID of the newly created source.

Supported Affiliate Networks

Affiliate NetworkRequired CredentialsVariable Names
CJAccess Token, Company ID (CID)accessToken, companyId
AwinAPI KeyapiKey
ShareASaleAPI Token, API Secret, Affiliate IDapiToken, apiSecret, affiliateId
ClickBankAPI KeyapiKey
FlexOffersAPI TokenapiToken
RakutenSecurity Key, Tracking IDsecurityKey, trackingId
Impact.comAccount SID, Auth TokenaccountSid, authToken

Example for Shopify:

Check built-with to validate whether a shop is using Shopify.

mutation {
  saveSource(
    source: {
      name: "MrBeast Shopify Store",
      type: Shopify,
      url: "https://mrbeast.shop/", # use the shop url
    }
  )
}

Example for CJ Affiliate:

mutation {
  saveSource(
    source: {
      name: "Vestiare Collective on CJ",
      type: CJ,
      credentials: { 
        accessToken: "YOUR_CJ_ACCESS_TOKEN", 
        companyId: "YOUR_CJ_COMPANY_ID" 
      } # Credentials will be stored securely and cannot be retrieved once saved.
    }
  )
}

Response:

{
  "data": {
    "saveSource": "121" // ID of the newly created source
  }
}

Mutation: deleteSource

Deletes a saved data source.

deleteSource(id: ID!): Boolean!

Example:

mutation {
  deleteSource(id: "121")
}

Response:

{
  "data": {
    "deleteSource": true // whether the source was deleted successfully
  }
}

Note on Credentials

For security reasons, sensitive credentials (like API keys) should be passed in the credentials field of the SourceRequest. These will be stored securely and cannot be retrieved once saved. Credentials can be referenced in the ‘url’, ‘sourceHeaders’, and ‘sourceBody’ fields of the SourceRequest object with the `$` syntax.

Example:

url: "https://example.com/api/v1/${CREDENTIAL_NAME}"
sourceHeaders: ["Authorization: Bearer ${CREDENTIAL_NAME}"]
sourceBody: { "apiKey": "${CREDENTIAL_NAME}" }

The CREDENTIAL_NAME will be replaced with the decrypted value of the credential when the source is executed.