Fluent Commerce Logo
Docs

Create or Update Sourcing Profile

Essential knowledge

Intended Audience:

Technical User

Author:

Kirill Gaiduk

Changed on:

2 Oct 2025

Overview

The `createSourcingProfile` mutation creates a Sourcing Profile (or its newer version, i.e., updates) for a Retailer:

  • If the provided `ref` is unique, it creates the first version with `ACTIVE` status
  • If a `SourcingProfile` with the same `ref` already exists, it creates a new version with `DRAFT` status

Key points

  • Prerequisites: User should have `SOURCINGPROFILE_CREATE` and `SOURCINGPROFILE_VIEW` permissions
  • Retailer association is permanent: After a Retailer is assigned to a Profile, reassignment to another Retailer is not possible
  • Use clear refs and names: Follow recommended formats (e.g., `GLOBAL_DEFAULT`)
  • Order defines priority: The order of Sourcing Strategies and Criteria determines their application

Inputs

The Input fields for creating a Sourcing Profile are defined with the `CreateSourcingProfileInput`:

Field

Type

Description

Notes

`ref`

`String!`

Unique reference of the Sourcing Profile

Provide a business-readable reference (in order to make the `ref` value more self-descriptive) or an universally unique identifier (UUID)

Recommended format: `<SCOPE>_<SLUG>`
Example: `GLOBAL_DEFAULT`

Parts:

  • SCOPE - where the profile applies: GLOBAL, HQ, market/region codes (ANZ, US, EU), or site codes (SYD, CHI01)
  • SLUG - short purpose label. Use uppercase letters, digits, and underscores only. Examples:
    • Operational defaults: DEFAULT, STANDARD, LOW_SPLIT
    • Speed & promise: FAST, EXPRESS, ECONOMY
    • Product/campaign: SHOES_SUMMER, BACK_TO_SCHOOL, BLACK_FRIDAY
    • Business rules: COST_OPTIMIZED, MARGIN_OPTIMIZED, DISTANCE_OPTIMIZED
    • Special flows: RETURNS_ONLY, PREORDER, VIP

The uniqueness of a Sourcing Profile is determined by the combination of `ref` and `version`

`versionComment`

`String`

Comment for the Sourcing Profile version


`name`

`String!`

Human-readable name of the Sourcing Profile


`description`

`String`

Human-readable description of the Sourcing Profile


`retailer`

`RetailerId!`

Retailer to which the Sourcing Profile belongs to

The Sourcing Profile’s Retailer is immutable after it is set by the create mutation; updates are not allowed

See the Access Validation section below for more details

`defaultVirtualCatalogue`

`VirtualCatalogueKey`

Virtual Catalog Reference used by default

The Virtual Catalog Reference is required to retrieve Available-to-Sell (ATS) quantities for the requested Items

`defaultNetwork`

`NetworkKey`

Network Reference used by default

The Network Reference is required to retrieve the list of available Locations for sourcing request fulfillment

`defaultMaxSplit`

`Int`

Limit of split operations used by default

`Max Split = (allowed number of Fulfillments)  - 1`

  • An empty (`null`) input is treated as zero (In this case, the sourcing request can be fulfilled by only one Fulfillment)
  • Negative inputs are invalid

`sourcingStrategies`

`[CreateSourcingStrategyInput!]`

List of Primary Sourcing Strategies of the Sourcing Profile

The order of inputs defines the `priority` of the Primary Sourcing Strategies

`sourcingFallbackStrategies`

`[CreateSourcingFallbackStrategyInput!]`

List of Fallback Sourcing Strategies of the Sourcing Profile

The order of inputs defines the `priority` of the Fallback Sourcing Strategies

The Input fields for adding Primary and Fallback Sourcing Strategies are defined with the `CreateSourcingStrategyInput` and `CreateSourcingFallbackStrategyInput`:

Field

Type

Description

Notes

`ref`

`String!`

Reference of the Primary / Fallback Sourcing Strategy

The Sourcing Strategy Reference must be unique within a specific Sourcing Profile version

  • When adding a new Sourcing Strategy, provide a new unique `ref`
  • When editing an existing Sourcing Strategy, preserve the same `ref`

Recommendation: use a UUID in order to guarantee uniqueness.

Example: `9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d`

`name`

`String!`

Human-readable name of the Primary / Fallback Sourcing Strategy


`description`

`String`

Human-readable description of the Primary / Fallback Sourcing Strategy


`status`

`String`

Status of the Primary / Fallback Sourcing Strategy

The `status` is `ACTIVE` by default

`virtualCatalogue`

`VirtualCatalogueKey`

Virtual Catalog Reference used by the Primary / Fallback Sourcing Strategy

  • If a Strategy Virtual Catalog is provided, it overrides the `defaultVirtualCatalogue` value
  • If empty (`null`), the Strategy inherits the `defaultVirtualCatalogue` value

`network`

`NetworkKey`

Network Reference used by the Primary / Fallback Sourcing Strategy

  • If a Strategy Network is provided, it overrides the `defaultNetwork` value
  • If empty (`null`), the Strategy inherits the `defaultNetwork` value

`maxSplit`

`Int`

Limit of split operations used by the Primary / Fallback Sourcing Strategy

`Max Split = (allowed number of Fulfillments)  - 1`

  • If a Strategy Max Split is provided, it overrides the `defaultMaxSplit` value
  • If empty (`null`), the Strategy inherits the `defaultMaxSplit` value

Negative inputs are invalid

`sourcingConditions`

`[CreateSourcingConditionInput!]`

List of Sourcing Conditions that determine whether a Sourcing Strategy is applicable to a sourcing request

When multiple Sourcing Conditions are provided, they are evaluated using a logical AND

`sourcingCriteria`

`[CreateSourcingCriterionInput!]`

List of Sourcing Criteria used to rank Locations during the sourcing process

The order of inputs matters because each subsequent Sourcing Criterion acts as a tie-breaker

The Input fields for adding Sourcing Conditions and Criteria are defined with the `CreateSourcingConditionInput` and `CreateSourcingCriterionInput`:

Field

Type

Description

Notes

`name`

`String!`

Name of the Sourcing Condition / Criterion

The Name serves as a unique identifier for Sourcing Conditions and Criteria

`type`

`String!`

Type of the Sourcing Condition / Criterion

The Type is mapped to a specific function in the `util-sourcing` library

`params`

`Json`

Parameters of the Sourcing Condition / Criterion

The Parameters configure Sourcing Conditions and Criteria to support specific customer sourcing logic

Access Validation

The GraphQL framework applies the Standard Permission Check for the target operation and entity:

  • Retailer scope: The Retailer associated with the target entity (or provided in the request) defines the scope for evaluation
  • Role-based access: A user can hold one or more user roles. Each `UserRole` contributes:
    • Permissions via its assigned role (e.g., `SOURCINGPROFILE_CREATE`, `SOURCINGPROFILE_UPDATE`, `SOURCINGPROFILE_VIEW`)
    • Contexts (`RoleContext`) that scope those permissions:
      • `ACCOUNT` - applies across all Retailers
      • `RETAILER` - applies only when the context’s Retailer ID (`contextId`) matches the target Retailer

Result: The request succeeds only if at least one user role grants the required permission in a context applicable to the target Retailer; otherwise, the request is denied or the response contains `null`.

Sample Payload

1mutation createSourcingProfile($input: CreateSourcingProfileInput) {
2    createSourcingProfile (input: $input) {
3        id
4        ref
5        version
6        versionComment
7        name
8        description
9        status
10        user {
11            id
12        }
13        createdOn
14        updatedOn
15        retailer {
16            id
17        }
18        defaultVirtualCatalogue {
19            ref
20        }
21        defaultNetwork {
22            ref
23        }
24        defaultMaxSplit
25        sourcingStrategies {
26            id
27            ref
28            sourcingProfile {
29                id
30            }
31            name
32            description
33            status
34            priority
35            createdOn
36            updatedOn
37            virtualCatalogue {
38                ref
39            }
40            network {
41                ref
42            }
43            maxSplit
44            sourcingConditions {
45                name
46                type
47                params
48            }
49            sourcingCriteria {
50                name
51                type
52                params
53            }
54        }
55        sourcingFallbackStrategies {
56            id
57            ref
58            sourcingProfile {
59                id
60            }
61            name
62            description
63            status
64            priority
65            createdOn
66            updatedOn
67            virtualCatalogue {
68                ref
69            }
70            network {
71                ref
72            }
73            maxSplit
74            sourcingConditions {
75                name
76                type
77                params
78            }
79            sourcingCriteria {
80                name
81                type
82                params
83            }
84        }
85    }
86}
1{
2  "input": {
3    "ref": "GLOBAL_DEFAULT",
4    "versionComment": "Lorem ipsum",
5    "name": "Lorem ipsum",
6    "description": "Lorem ipsum",
7    "retailer": {
8      "id": 1
9    },
10    "defaultVirtualCatalogue": {
11      "ref": "BASE:1"
12    },
13    "defaultNetwork": {
14      "ref": "CLICK_AND_COLLECT"
15    },
16    "defaultMaxSplit": 5,
17    "sourcingStrategies": [
18      {
19        "ref": "bbc42abb-609b-495a-ab74-d3c6d55ca445",
20        "name": "Primary Lorem ipsum",
21        "description": "Primary Lorem ipsum",
22        "status": "ACTIVE",
23        "sourcingConditions": [
24        ],
25        "sourcingCriteria": [          
26          {
27            "name": "locationDistance",
28            "type": "fc.sourcing.criterion.locationDistance"
29          }
30        ]
31      }
32    ],
33    "sourcingFallbackStrategies": [
34      {
35        "ref": "7c194aef-dd50-4d8e-9b8d-b59df4090740",
36        "name": "Fallback Lorem ipsum",
37        "description": "Fallback Lorem ipsum",
38        "status": "ACTIVE",
39        "sourcingConditions": [
40        ],
41        "sourcingCriteria": [          
42          {
43            "name": "locationDistance",
44            "type": "fc.sourcing.criterion.locationDistance"
45          }
46        ]
47      }
48    ]
49  }
50}
1{
2    "data": {
3        "createSourcingProfile": {
4            "id": "607",
5            "ref": "GLOBAL_DEFAULT",
6            "version": 1,
7            "versionComment": "Lorem ipsum",
8            "name": "Lorem ipsum",
9            "description": "Lorem ipsum",
10            "status": "ACTIVE",
11            "user": {
12                "id": "1982"
13            },
14            "createdOn": "2025-08-27T20:33:01.469Z",
15            "updatedOn": "2025-08-27T20:33:01.469Z",
16            "retailer": {
17                "id": "1"
18            },
19            "defaultVirtualCatalogue": {
20                "ref": "BASE:1"
21            },
22            "defaultNetwork": {
23                "ref": "CLICK_AND_COLLECT"
24            },
25            "defaultMaxSplit": 5,
26            "sourcingStrategies": [
27                {
28                    "id": "1019",
29                    "ref": "bbc42abb-609b-495a-ab74-d3c6d55ca445",
30                    "sourcingProfile": {
31                        "id": "607"
32                    },
33                    "name": "Primary Lorem ipsum",
34                    "description": "Primary Lorem ipsum",
35                    "status": "ACTIVE",
36                    "priority": 1,
37                    "createdOn": "2025-08-27T20:33:01.478Z",
38                    "updatedOn": "2025-08-27T20:33:01.478Z",
39                    "virtualCatalogue": null,
40                    "network": null,
41                    "maxSplit": null,
42                    "sourcingConditions": null,
43                    "sourcingCriteria": [
44                        {
45                            "name": "locationDistance",
46                            "type": "fc.sourcing.criterion.locationDistance",
47                            "params": null
48                        }
49                    ]
50                }
51            ],
52            "sourcingFallbackStrategies": [
53                {
54                    "id": "555",
55                    "ref": "7c194aef-dd50-4d8e-9b8d-b59df4090740",
56                    "sourcingProfile": {
57                        "id": "607"
58                    },
59                    "name": "Fallback Lorem ipsum",
60                    "description": "Fallback Lorem ipsum",
61                    "status": "ACTIVE",
62                    "priority": 1,
63                    "createdOn": "2025-08-27T20:33:01.473Z",
64                    "updatedOn": "2025-08-27T20:33:01.473Z",
65                    "virtualCatalogue": null,
66                    "network": null,
67                    "maxSplit": null,
68                    "sourcingConditions": null,
69                    "sourcingCriteria": [
70                        {
71                            "name": "locationDistance",
72                            "type": "fc.sourcing.criterion.locationDistance",
73                            "params": null
74                        }
75                    ]
76                }
77            ]
78        }
79    }
80}