Map Policy Partners GraphQL API

Welcome to our GraphQL API. These pages will detail the API and also provide instructions for authenticating and Webhooks.

API Endpoints
https://app.mappolicypartners.com/graphql
Version

1.0.0

API Authentication

When making requests to the API, you'll have to make sure your requests are authenticated. To do this you'll want to set the Bearer token to the token located on the profile page.

Profile Page

In the Profile Page, click on the API tab and then copy the token listed.

API Token

With the token you can make your first request.

Curl

curl --request POST \
  --url http://app.mappolicypartners.com/graphql \
  --header 'Authorization: Bearer BEARER-TOKEN-GOES-HERE' \
  --header 'Content-Type: application/json' \
  --data '{"query":"{\n  products(first: 10) {\n    nodes {\n      title\n    }\n  }\n}"}'

Webhooks

Webhooks are a new beta feature that allow you to receive notifications as soon as an Event happens. Currently we send out notifications each time a new unauthorized seller appears on a product. To receive these notifications you'll have to setup a webhook for a URL of your choice. You can do this by visiting the Webhooks section on the menu.

Webhooks Page

Then click the Add Webhook button.

Add Webhook

Add a URL that you'd like the Webhook sent to. Once added, the system will start sending webhooks as POST requests with the webhooks' payload formatted in JSON. Below is an example:

{
  "payload": {
    "seller_name": "NewSeller.com",
    "product_name": "Blue Sneaker (M)"
  },
  "event": "unauthorized_seller.new"
}

Since the webhook's only fire when scraping is taking place, it'll be more convenient to send a few test webhooks to confirm your system is setup properly.

Confirming Your Webhooks

To confirm that your webhooks originated from Map Policy Partners you can confirm the webhook by encoding the request body of the webhook, with the secret found in the list of webhooks.

hash  = OpenSSL::Digest::Digest.new('sha256')
Base64.encode64(OpenSSL::HMAC.digest(hash, webhook_secret, json_request_body)).strip

If the Base64 encoded string matches the value in the HTTP_WEBHOOK_SIGNATURE of the request, then you can confirm that the webhook in genuine.

The secret can be found on the Webhooks view page.

Webhook Secret

Limits

All queries max out at returning 1000 records. To fetch more you can paginate through the records using the GraphQL Cursor Connections Specification.

Queries

accountSellers

Description

A list of merged sellers selling your products

Response

Returns an AccountSellerConnection!

Arguments
Name Description
after - String Returns the elements in the list that come after the specified cursor.
before - String Returns the elements in the list that come before the specified cursor.
first - Int Returns the first n elements from the list.
last - Int Returns the last n elements from the list.

Example

Query
query accountSellers(
  $after: String,
  $before: String,
  $first: Int,
  $last: Int
) {
  accountSellers(
    after: $after,
    before: $before,
    first: $first,
    last: $last
  ) {
    edges {
      ...AccountSellerEdgeFragment
    }
    nodes {
      ...AccountSellerFragment
    }
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{
  "after": "abc123",
  "before": "xyz789",
  "first": 987,
  "last": 987
}
Response
{
  "data": {
    "accountSellers": {
      "edges": [AccountSellerEdge],
      "nodes": [AccountSeller],
      "pageInfo": PageInfo
    }
  }
}

productPrices

Description

A list of product price scans

Response

Returns a ProductPriceConnection!

Arguments
Name Description
after - String Returns the elements in the list that come after the specified cursor.
before - String Returns the elements in the list that come before the specified cursor.
first - Int Returns the first n elements from the list.
last - Int Returns the last n elements from the list.
sortBy - SortByInput Sort the results by the specified field in the specified direction
createdWithin - TimeRangeInput Filter to results that were created within the specified time range

Example

Query
query productPrices(
  $after: String,
  $before: String,
  $first: Int,
  $last: Int,
  $sortBy: SortByInput,
  $createdWithin: TimeRangeInput
) {
  productPrices(
    after: $after,
    before: $before,
    first: $first,
    last: $last,
    sortBy: $sortBy,
    createdWithin: $createdWithin
  ) {
    edges {
      ...ProductPriceEdgeFragment
    }
    nodes {
      ...ProductPriceFragment
    }
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{
  "after": "xyz789",
  "before": "abc123",
  "first": 987,
  "last": 987,
  "sortBy": SortByInput,
  "createdWithin": TimeRangeInput
}
Response
{
  "data": {
    "productPrices": {
      "edges": [ProductPriceEdge],
      "nodes": [ProductPrice],
      "pageInfo": PageInfo
    }
  }
}

products

Description

A list of your products

Response

Returns a UserProductConnection!

Arguments
Name Description
after - String Returns the elements in the list that come after the specified cursor.
before - String Returns the elements in the list that come before the specified cursor.
first - Int Returns the first n elements from the list.
last - Int Returns the last n elements from the list.

Example

Query
query products(
  $after: String,
  $before: String,
  $first: Int,
  $last: Int
) {
  products(
    after: $after,
    before: $before,
    first: $first,
    last: $last
  ) {
    edges {
      ...UserProductEdgeFragment
    }
    nodes {
      ...UserProductFragment
    }
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{
  "after": "xyz789",
  "before": "abc123",
  "first": 123,
  "last": 123
}
Response
{
  "data": {
    "products": {
      "edges": [UserProductEdge],
      "nodes": [UserProduct],
      "pageInfo": PageInfo
    }
  }
}

sellers

Description

A list of seller selling your products

Response

Returns an AccountStoreSellerConnection!

Arguments
Name Description
after - String Returns the elements in the list that come after the specified cursor.
before - String Returns the elements in the list that come before the specified cursor.
first - Int Returns the first n elements from the list.
last - Int Returns the last n elements from the list.

Example

Query
query sellers(
  $after: String,
  $before: String,
  $first: Int,
  $last: Int
) {
  sellers(
    after: $after,
    before: $before,
    first: $first,
    last: $last
  ) {
    edges {
      ...AccountStoreSellerEdgeFragment
    }
    nodes {
      ...AccountStoreSellerFragment
    }
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{
  "after": "xyz789",
  "before": "xyz789",
  "first": 123,
  "last": 123
}
Response
{
  "data": {
    "sellers": {
      "edges": [AccountStoreSellerEdge],
      "nodes": [AccountStoreSeller],
      "pageInfo": PageInfo
    }
  }
}

Types

AccountSeller

Description

A merged seller entity that represents one or more AccountStoreSellers that have been combined together. Multiple seller accounts across different stores can be merged into a single AccountSeller for unified management of contact information, notes, and enforcement.

Fields
Field Name Description
accountStoreSellers - AccountStoreSellerConnection!
Arguments
after - String

Returns the elements in the list that come after the specified cursor.

before - String

Returns the elements in the list that come before the specified cursor.

first - Int

Returns the first n elements from the list.

last - Int

Returns the last n elements from the list.

allCurrentListingsOutOfStock - Boolean!
authorized - Boolean!
businessName - String
city - String
country - String
createdAt - ISO8601DateTime!
currentSoleViolator - Boolean!
currentViolationCount - Int!
currentViolationMarginCents - Int!
currentViolationMarginCurrency - String!
emailAddressesCount - Int!
emails - String! A comma separated list of emails for contacting the seller.
enforcementCount - Int!
enforcementStatus - String!
id - ID!
lastEnforcementAt - ISO8601DateTime
mostRecentlyViolatedAt - ISO8601DateTime
name - String
note - String
phoneNumber - String
state - String
stopViolationNoticeSentAt - ISO8601DateTime
street - String
street2 - String
updatedAt - ISO8601DateTime!
violations - ProductPriceConnection!
Arguments
after - String

Returns the elements in the list that come after the specified cursor.

before - String

Returns the elements in the list that come before the specified cursor.

first - Int

Returns the first n elements from the list.

last - Int

Returns the last n elements from the list.

zipcode - String
Example
{
  "accountStoreSellers": AccountStoreSellerConnection,
  "allCurrentListingsOutOfStock": false,
  "authorized": false,
  "businessName": "xyz789",
  "city": "abc123",
  "country": "xyz789",
  "createdAt": ISO8601DateTime,
  "currentSoleViolator": false,
  "currentViolationCount": 987,
  "currentViolationMarginCents": 987,
  "currentViolationMarginCurrency": "xyz789",
  "emailAddressesCount": 123,
  "emails": "xyz789",
  "enforcementCount": 123,
  "enforcementStatus": "abc123",
  "id": 4,
  "lastEnforcementAt": ISO8601DateTime,
  "mostRecentlyViolatedAt": ISO8601DateTime,
  "name": "xyz789",
  "note": "abc123",
  "phoneNumber": "xyz789",
  "state": "abc123",
  "stopViolationNoticeSentAt": ISO8601DateTime,
  "street": "xyz789",
  "street2": "abc123",
  "updatedAt": ISO8601DateTime,
  "violations": ProductPriceConnection,
  "zipcode": "xyz789"
}

AccountSellerConnection

Description

The connection type for AccountSeller.

Fields
Field Name Description
edges - [AccountSellerEdge] A list of edges.
nodes - [AccountSeller] A list of nodes.
pageInfo - PageInfo! Information to aid in pagination.
Example
{
  "edges": [AccountSellerEdge],
  "nodes": [AccountSeller],
  "pageInfo": PageInfo
}

AccountSellerEdge

Description

An edge in a connection.

Fields
Field Name Description
cursor - String! A cursor for use in pagination.
node - AccountSeller The item at the end of the edge.
Example
{
  "cursor": "abc123",
  "node": AccountSeller
}

AccountStoreSeller

Description

An individual seller account on a specific store (e.g., a specific Amazon seller ID). Multiple AccountStoreSellers can be merged together into a single AccountSeller for unified management.

Fields
Field Name Description
accountSeller - AccountSeller!
authorized - Boolean! Whether this seller is explicitly authorized to sell your product. Authorization is now managed on the AccountSeller. Please use accountSeller.authorized instead.
city - String! Contact information is now managed on the AccountSeller. Please use accountSeller.city instead.
country - String! Contact information is now managed on the AccountSeller. Please use accountSeller.country instead.
createdAt - ISO8601DateTime!
emails - String! A comma separated list of emails for contacting the seller. Contact information is now managed on the AccountSeller. Please use accountSeller.emails instead.
id - ID!
mostRecentViolation - ProductPrice
name - String Contact information is now managed on the AccountSeller. Please use accountSeller.name instead.
notes - String Notes are now managed on the AccountSeller. Please use accountSeller.note instead.
phoneNumber - String Contact information is now managed on the AccountSeller. Please use accountSeller.phoneNumber instead.
state - String! Contact information is now managed on the AccountSeller. Please use accountSeller.state instead.
storeId - String!
street - String! Contact information is now managed on the AccountSeller. Please use accountSeller.street instead.
street2 - String! Contact information is now managed on the AccountSeller. Please use accountSeller.street2 instead.
updatedAt - ISO8601DateTime!
violations - ProductPriceConnection!
Arguments
after - String

Returns the elements in the list that come after the specified cursor.

before - String

Returns the elements in the list that come before the specified cursor.

first - Int

Returns the first n elements from the list.

last - Int

Returns the last n elements from the list.

zipcode - String! Contact information is now managed on the AccountSeller. Please use accountSeller.zipcode instead.
Example
{
  "accountSeller": AccountSeller,
  "authorized": true,
  "city": "abc123",
  "country": "abc123",
  "createdAt": ISO8601DateTime,
  "emails": "abc123",
  "id": 4,
  "mostRecentViolation": ProductPrice,
  "name": "abc123",
  "notes": "xyz789",
  "phoneNumber": "abc123",
  "state": "abc123",
  "storeId": "xyz789",
  "street": "abc123",
  "street2": "xyz789",
  "updatedAt": ISO8601DateTime,
  "violations": ProductPriceConnection,
  "zipcode": "xyz789"
}

AccountStoreSellerConnection

Description

The connection type for AccountStoreSeller.

Fields
Field Name Description
edges - [AccountStoreSellerEdge] A list of edges.
nodes - [AccountStoreSeller] A list of nodes.
pageInfo - PageInfo! Information to aid in pagination.
Example
{
  "edges": [AccountStoreSellerEdge],
  "nodes": [AccountStoreSeller],
  "pageInfo": PageInfo
}

AccountStoreSellerEdge

Description

An edge in a connection.

Fields
Field Name Description
cursor - String! A cursor for use in pagination.
node - AccountStoreSeller The item at the end of the edge.
Example
{
  "cursor": "xyz789",
  "node": AccountStoreSeller
}

Boolean

Description

Represents true or false values.

Example
true

ID

Description

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

Example
"4"

ISO8601DateTime

Description

An ISO 8601-encoded datetime

Example
ISO8601DateTime

Int

Description

Represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.

Example
123

PageInfo

Description

Information about pagination in a connection.

Fields
Field Name Description
endCursor - String When paginating forwards, the cursor to continue.
hasNextPage - Boolean! When paginating forwards, are there more items?
hasPreviousPage - Boolean! When paginating backwards, are there more items?
startCursor - String When paginating backwards, the cursor to continue.
Example
{
  "endCursor": "xyz789",
  "hasNextPage": true,
  "hasPreviousPage": false,
  "startCursor": "xyz789"
}

ProductCondition

Values
Enum Value Description

NEW

New product

USED

Used product
Example
"NEW"

ProductPrice

Fields
Field Name Description
accountSeller - AccountSeller!
accountStoreSeller - AccountStoreSeller!
accountStoreSellerAuthorized - Boolean! Because whether or not a seller is authorized can change over time, this field stores the authorization status at the time of the product price. You can get the current seller authorized status off the AccountStoreSeller object.
addToCartPrice - Boolean!
autoshipPrice - Boolean!
availableForOrder - Int
buyBox - Boolean!
channel - String!
createdAt - ISO8601DateTime!
displayProductUrl - String!
fulfilledByAmazon - Boolean!
id - ID!
mapPriceCents - Int!
mapPriceCurrency - String!
outOfStock - Boolean!
productCondition - ProductCondition!
promotion - Boolean
screenshotUrl - String
soleProductViolation - Boolean! This violation is the only violation found during this scan.
storePriceCents - Int!
storePriceCurrency - String!
storeProductId - String!
updatedAt - ISO8601DateTime!
userProduct - UserProduct!
userSeller - AccountStoreSeller! Please use the accountStoreSeller field instead.
userSellerAuthorized - Boolean! Because whether or not a seller is authorized can change over time, this field stores the authorization status at the time of the product price. You can get the current seller authorized status off the userSeller object. Please use the accountStoreSellerAuthorized field instead.
violation - Boolean! Whether or not this price is a MAP violation
Example
{
  "accountSeller": AccountSeller,
  "accountStoreSeller": AccountStoreSeller,
  "accountStoreSellerAuthorized": true,
  "addToCartPrice": false,
  "autoshipPrice": true,
  "availableForOrder": 987,
  "buyBox": false,
  "channel": "xyz789",
  "createdAt": ISO8601DateTime,
  "displayProductUrl": "abc123",
  "fulfilledByAmazon": false,
  "id": "4",
  "mapPriceCents": 123,
  "mapPriceCurrency": "xyz789",
  "outOfStock": true,
  "productCondition": "NEW",
  "promotion": true,
  "screenshotUrl": "abc123",
  "soleProductViolation": false,
  "storePriceCents": 123,
  "storePriceCurrency": "xyz789",
  "storeProductId": "abc123",
  "updatedAt": ISO8601DateTime,
  "userProduct": UserProduct,
  "userSeller": AccountStoreSeller,
  "userSellerAuthorized": false,
  "violation": false
}

ProductPriceConnection

Description

The connection type for ProductPrice.

Fields
Field Name Description
edges - [ProductPriceEdge] A list of edges.
nodes - [ProductPrice] A list of nodes.
pageInfo - PageInfo! Information to aid in pagination.
Example
{
  "edges": [ProductPriceEdge],
  "nodes": [ProductPrice],
  "pageInfo": PageInfo
}

ProductPriceEdge

Description

An edge in a connection.

Fields
Field Name Description
cursor - String! A cursor for use in pagination.
node - ProductPrice The item at the end of the edge.
Example
{
  "cursor": "abc123",
  "node": ProductPrice
}

SortByInput

Description

The field and direction to sort the results by

Fields
Input Field Description
field - SortableFields! The field to sort the results by
direction - SortDirection! Direction to sort the specified field
Example
{"field": "CREATED_AT", "direction": "ASC"}

SortDirection

Values
Enum Value Description

ASC

Sort ascending

DESC

Sort descending
Example
"ASC"

SortableFields

Values
Enum Value Description

CREATED_AT

UPDATED_AT

Example
"CREATED_AT"

String

Description

Represents textual data as UTF-8 character sequences. This type is most often used by GraphQL to represent free-form human-readable text.

Example
"abc123"

TimeRangeInput

Description

A time range with a start and end time

Fields
Input Field Description
startTime - ISO8601DateTime!
endTime - ISO8601DateTime!
Example
{
  "startTime": ISO8601DateTime,
  "endTime": ISO8601DateTime
}

UserProduct

Fields
Field Name Description
archived - Boolean! Products that are archived don't count toward your SKU count and are not scanned.
asin - String
brand - String
color - String
company - String
createdAt - ISO8601DateTime!
currentProductPrices - ProductPriceConnection!
Arguments
after - String

Returns the elements in the list that come after the specified cursor.

before - String

Returns the elements in the list that come before the specified cursor.

first - Int

Returns the first n elements from the list.

last - Int

Returns the last n elements from the list.

description - String
ean - String Use GTIN instead
gtin - String
id - ID!
manufacturer - String
manufacturerPartNumber - String!
mapPriceUsCents - Int!
mapPriceUsCurrency - String!
notes - String!
productPrices - ProductPriceConnection! A list of product price scans
Arguments
after - String

Returns the elements in the list that come after the specified cursor.

before - String

Returns the elements in the list that come before the specified cursor.

first - Int

Returns the first n elements from the list.

last - Int

Returns the last n elements from the list.

sortBy - SortByInput

Sort the results by the specified field in the specified direction

createdWithin - TimeRangeInput

Filter to results that were created within the specified time range

size - String
sku - String
soleViolations - ProductPriceConnection! Sole violations are cases where there is only one violating seller. This is important because these sellers can trigger other sellers to automatically drop their prices below MAP.
Arguments
after - String

Returns the elements in the list that come after the specified cursor.

before - String

Returns the elements in the list that come before the specified cursor.

first - Int

Returns the first n elements from the list.

last - Int

Returns the last n elements from the list.

title - String
upc - String Use GTIN instead
updatedAt - ISO8601DateTime!
violatingMap - Boolean! Whether this product is current violating your MAP policy.
violations - ProductPriceConnection!
Arguments
after - String

Returns the elements in the list that come after the specified cursor.

before - String

Returns the elements in the list that come before the specified cursor.

first - Int

Returns the first n elements from the list.

last - Int

Returns the last n elements from the list.

Example
{
  "archived": false,
  "asin": "abc123",
  "brand": "abc123",
  "color": "abc123",
  "company": "xyz789",
  "createdAt": ISO8601DateTime,
  "currentProductPrices": ProductPriceConnection,
  "description": "abc123",
  "ean": "xyz789",
  "gtin": "abc123",
  "id": "4",
  "manufacturer": "abc123",
  "manufacturerPartNumber": "xyz789",
  "mapPriceUsCents": 987,
  "mapPriceUsCurrency": "xyz789",
  "notes": "xyz789",
  "productPrices": ProductPriceConnection,
  "size": "xyz789",
  "sku": "abc123",
  "soleViolations": ProductPriceConnection,
  "title": "xyz789",
  "upc": "xyz789",
  "updatedAt": ISO8601DateTime,
  "violatingMap": false,
  "violations": ProductPriceConnection
}

UserProductConnection

Description

The connection type for UserProduct.

Fields
Field Name Description
edges - [UserProductEdge] A list of edges.
nodes - [UserProduct] A list of nodes.
pageInfo - PageInfo! Information to aid in pagination.
Example
{
  "edges": [UserProductEdge],
  "nodes": [UserProduct],
  "pageInfo": PageInfo
}

UserProductEdge

Description

An edge in a connection.

Fields
Field Name Description
cursor - String! A cursor for use in pagination.
node - UserProduct The item at the end of the edge.
Example
{
  "cursor": "xyz789",
  "node": UserProduct
}