Mutation Reference

Mutation: upsertAndEnrollPublisher

Returns: UpsertAndEnrollPublisherResponse!

Allows CJ integration partners to enroll a creator into their CJ program. If the creator does not already have a CJ account, one will be automatically created before enrollment.

ArgumentTypeDescription
inputUpsertAndEnrollPublisherInputThe data needed to upsert and enroll the publisher. See UpsertAndEnrollPublisherInput below.

Example: Enrolling a Publisher

Request

mutation UpsertAndEnrollPublisher($input: UpsertAndEnrollPublisherInput) {
  upsertAndEnrollPublisher(input: $input) {
    emailAddress
    company {
      id
      promotionalProperties {
        id
      }
    }
  }
}

Variables

{
  "input": {
    "user": {
      "firstName": "John",
      "lastName": "Smith",
      "phoneNumber": "+123456789",
      "emailAddress": "[email protected]"
    },
    "company": {
      "name": "ACME Corporation Company",
      "address": {
        "addressLineOne": "1234 Main Street",
        "addressLineTwo": "Suite 500",
        "city": "Cleveland",
        "countryCode": "US",
        "countrySubdivisionCode": "OH",
        "postalCode": "44101"
      },
      "functionalCurrency": "USD",
      "description": "This string a very long string. This string a very long string. This string a very long string. This string a very long string. This string a very long string. This string a very long string. This string a very long string. This string a very long string. This string a very long string. This string a very long string.",
      "promotionalProperties": [
        {
          "socialMedia": {
            "handle": "insta_user92",
            "platform": "INSTAGRAM"
          }
        }
      ]
    },
    "enrollment": {
      "partnershipId": "rgf3ddf2er",
      "brandedSignupId": "de2erde2s",
      "externalUserId": "dq1w2d4"
    }
  }
}

Response

{
  "data": {
    "upsertAndEnrollPublisher": {
      "emailAddress": "[email protected]",
      "company": {
        "id": "1234321",
        "promotionalProperties": [
          { "id": "321123" }
        ]
      }
    }
  }
}

Example: Failure Response

The description field in UpsertPublisherCompanyInput must be at least 250 characters. Supplying a shorter string results in an InvalidArguments error.

Variables (invalid — description too short)

{
  "input": {
    "user": {
      "firstName": "John",
      "lastName": "Smith",
      "phoneNumber": "+123456789",
      "emailAddress": "[email protected]"
    },
    "company": {
      "name": "ACME Corporation Company",
      "address": {
        "addressLineOne": "1234 Main Street",
        "addressLineTwo": "Suite 500",
        "city": "Cleveland",
        "countryCode": "US",
        "countrySubdivisionCode": "OH",
        "postalCode": "44101"
      },
      "functionalCurrency": "USD",
      "description": "This string a short description.",
      "promotionalProperties": [
        {
          "socialMedia": {
            "handle": "insta_user92",
            "platform": "INSTAGRAM"
          }
        }
      ]
    },
    "enrollment": {
      "partnershipId": "rgf3ddf2er",
      "brandedSignupId": "de2erde2s",
      "externalUserId": "dq1w2d4"
    }
  }
}

Response

{
  "errors": [
    {
      "message": "Invalid Arguments: Description must be at least 250 characters.",
      "locations": [{ "column": 3, "line": 2 }],
      "path": ["upsertAndEnrollPublisher"],
      "extensions": {
        "code": "InvalidArguments",
        "classification": "DataFetchingException"
      }
    }
  ],
  "data": null
}

Response Objects

UpsertAndEnrollPublisherResponse

Returned when the publisher is successfully enrolled in the partnership.

FieldTypeDescription
companyPublisherCompany!The publisher company that was created or matched.
emailAddressEmailAddress!The user email address associated with the account.

PublisherCompany

An organization in the CJ network that publishes content.

FieldTypeDescription
idID!The company identifier (CID) of the publisher.
promotionalProperties[PromotionalProperty!]!The promotional properties that were created for this publisher.

PromotionalProperty

FieldTypeDescription
idID!The unique identifier for the promotional property.

Input Objects

UpsertAndEnrollPublisherInput

Top-level input for the upsertAndEnrollPublisher mutation.

FieldTypeDescription
userUpsertUserInput!Lookup a user by email, or create a new user if one does not exist. If the user already exists, all fields other than emailAddress will be ignored unless they can be used to fill in missing data.
companyUpsertPublisherCompanyInput!If the user is newly created, also create the following publisher company. If the user already exists, this input is ignored except for promotionalProperties (which will always be created) and any fields that can fill in missing data.
enrollmentEnrollPublisherInput!Look up the publisher enrollment. If not already enrolled, attempt to enroll the publisher in the partnership.

UpsertUserInput

Personal details used to upsert a user.

FieldTypeDescription
emailAddressEmailAddress!User email address. Used as the lookup key.
firstNameString!User's first name.
lastNameString!User's last name.
phoneNumberPhoneNumber!User's phone number in E.164 format (e.g. +15555555555).

UpsertPublisherCompanyInput

Information needed to create a new publisher company and its associated promotional property.

FieldTypeDescription
nameString!Publisher company name.
addressAddressInput!Address of the publisher company.
functionalCurrencyFunctionalCurrency!Currency used for reporting. Cannot be changed after the account is created.
descriptionString!Publisher description. Must be at least 250 characters.
promotionalProperties[PromotionalPropertyInput!]!The promotional properties for this publisher. Exactly one is required.

EnrollPublisherInput

Looks up a publisher enrollment based on partnershipId. If the publisher is not already enrolled, enrolls them in the partnership.

FieldTypeDescription
partnershipIdID!Unique ID for the partnership account, assigned by CJ.
brandedSignupIdIDRequired for phase 2 partnerships.
externalUserIdString!The user's identifier from the partner system.

AddressInput

FieldTypeDescription
addressLineOneString!First line of the street address.
addressLineTwoStringSecond line of the street address (optional).
cityString!City.
countryCodeCountryCode!Two-letter ISO 3166-1 alpha-2 country code.
countrySubdivisionCodeStringState or province code.
postalCodeStringPostal or ZIP code.

PromotionalPropertyInput

The promotional properties controlled by the publisher.

FieldTypeDescription
socialMediaSocialMediaPropertyInput!Social media details for this promotional property.

SocialMediaPropertyInput

Details for a promotional property on a social media platform.

FieldTypeDescription
handleString!The unique handle or username on the specified platform (e.g. influencer_name).
platformSocialMediaPlatform!The social media platform. See SocialMediaPlatform enum.