1. Home
  2. Knowledge Base
  3. Integrations and API
  4. How to create vendors with the REST API

How to create vendors with the REST API

What you can do

Create vendors in CRIBWISE straight from your ERP with one POST to /ERP/Vendor/Create. A single call can carry several vendors, each with its purchasing rules, addresses, contact people, and notification recipients.

The interface only creates. There is no endpoint that updates or deletes a vendor, so an existing vendor is changed in the Admin Portal under Data management > Vendors — see How to manage vendors.


Endpoints

Method Endpoint What it does
POST [AP_base_uri]/ERP/Vendor/Create Queues one or more vendors for creation and returns a request GUID.
GET [AP_base_uri]/ERP/Vendor/GetRequestResult Returns the outcome of a create request, identified by its GUID.

[AP_base_uri] is the host your Admin Portal runs on, without the portal path. If you open the portal at https://solutionaddress.com/adminportal/yourcompany, the base address is https://solutionaddress.com. See the CRIBWISE REST API endpoint overview for the full endpoint list.


Before you start

  • An API key, exchanged for a bearer token that every call carries in its Authorization header — see How to authenticate with the REST API.
  • The Manage integrations permission, which is what makes Administration > Integration available so you can create the key — see the Admin Portal permissions reference.
  • At least one order template of type Order. Both OrderTemplateName and ConsignmentOrderTemplateName are mandatory and both must match one.
  • Decide whether the vendor is internal (your own workshop services the items) or external (items are sent away for service).

Important: VendorId and Name must each be unique across all vendors, and IsInternal is locked as soon as the vendor exists. None of the three can be corrected through this interface — fix them in the Admin Portal, or delete the vendor and create it again.


Quick start

Experienced users — create a vendor in 4 steps:

  1. Exchange your API key for a bearer token.
  2. POST a JSON array of vendor objects to [AP_base_uri]/ERP/Vendor/Create.
  3. Read the request GUID from the 200 response.
  4. GET /ERP/Vendor/GetRequestResult?requestGuid={GUID} until Status is Completed.

Need more detail? Follow the full steps below.


Steps

Step 1 — Look up the values your payload has to match

Three fields must point at something that already exists in CRIBWISE. Two of the three lists sit on the same settings page.

  1. In the left menu, select Administration.
  2. Select System settings.
  3. Open the Purchase tab.

Order templates lists the template names, and Vendor specific currencies lists the currencies that exist alongside the system default.

CRIBWISE Admin Portal System settings with red callouts marking (1) the Purchase tab, (2) the Order templates list showing DefaultTemplate, and (3) the empty Vendor specific currencies list

The Purchase tab (1) holds both reference lists: Order templates (2) and Vendor specific currencies (3). On this system only DefaultTemplate has the type Order, and no vendor-specific currency has been created.

Field Must match Where to find it
OrderTemplateName The Name of an order template whose Type is Order. Administration > System settings > Purchase > Order templates. Templates of type Invoice request are not offered for this field.
ConsignmentOrderTemplateName The same list. One template can serve both fields. As above.
PurchasingCurrency The name of the system default currency, or of a vendor-specific currency. Vendor-specific currencies are on the Purchase tab; the system default is on the General tab under Regional settings. Leave the field out and the vendor uses the system default — see How to configure currencies for purchasing.

Step 2 — Build the request body

The body is a JSON array of vendor objects, even when you send a single vendor. Four fields are mandatory.

Field Max length What it sets
Name 100 The vendor name shown in lists and on orders. Must be unique.
VendorId 100 The identifier used for purchasing and integration. Must be unique.
OrderTemplateName 100 The default layout for this vendor’s purchase orders.
ConsignmentOrderTemplateName 100 The same, for consignment orders.

New vendor form with (1) Vendor ID, (2) Name, (3) Order template, (4) Consignment order template, (5) Save vendor and (6) the five greyed-out tabs outlined in red

The same four values in the Admin Portal: Vendor ID (1) is VendorId, Name (2) is Name, Order template (3) is OrderTemplateName, and Consignment order template (4) is ConsignmentOrderTemplateName.

Every other field is optional. The full list is in the field reference below, including the nested AddressInformations and ContactPersons arrays.

Tip: Send your whole vendor list in one array rather than one call per vendor. Each object is validated on its own, so a vendor that fails does not stop the rest — the failures come back in Errors and the successes in CreatedVendors.

A complete request body for one vendor:

[
  {
    "Name": "Precision Tooling AB",
    "VendorId": "PTAB",
    "OrderTemplateName": "DefaultTemplate",
    "ConsignmentOrderTemplateName": "DefaultTemplate",
    "Description": "Carbide inserts and holders",
    "CustomerNumber": "SE-4471",
    "PurchasingCurrency": "EUR",
    "LeadTime": 5,
    "ServiceLeadTime": 10,
    "IsInternal": false,
    "IsManufacturer": true,
    "HasMinimalOrderValue": true,
    "MinimalValuePerOrder": 250,
    "PrimaryEmailAddress": "orders@precisiontooling.example",
    "PrimaryPhone": "+46 8 123 4567",
    "IsNotificationEnabled": true,
    "NotificationEmails": [ "purchasing@yourcompany.example" ],
    "NotificationOrderSent": true,
    "NotificationLateOrder": true,
    "AddressInformations": [
      {
        "CountryCode": "SE",
        "Street": "Verkstadsgatan",
        "StreetNumber": "12",
        "PostalCode": "112 51",
        "City": "Stockholm"
      }
    ],
    "ContactPersons": [
      {
        "Surname": "Lindqvist",
        "Name": "Mika",
        "Email": "mika.lindqvist@precisiontooling.example",
        "Phone": "+46 8 123 4570",
        "Position": "Account manager"
      }
    ]
  }
]

Step 3 — Send the request

  1. Set Content-Type to application/json.
  2. Set Authorization to Bearer {access_token}.
  3. POST the body to [AP_base_uri]/ERP/Vendor/Create.
  4. Read the request GUID from the response.

Important: 200 means the request was accepted, not that the vendors exist. The work is queued and runs in the background, so an integration that stops at the response never sees its own validation errors. Always follow up with GetRequestResult.

Step 4 — Check the result

  1. GET [AP_base_uri]/ERP/Vendor/GetRequestResult with the query parameter requestGuid set to the GUID from step 3.
  2. Read Status, and repeat the call until it reaches Completed or Failed.
  3. Read Result for the per-vendor outcome.
Request status What it means
Created The request has been received but is not in the task queue yet.
Ready The request is in the task queue, waiting to run.
Scheduled The request is queued to run at a later time.
Running The vendors are being created right now.
Completed Everything the request asked for has finished.
Failed The request could not be performed.

The response:

{
  "Message": "string",
  "Status": "Completed",
  "Result": {
    "CreatedVendors": [ "string" ],
    "Errors": [ "string" ]
  }
}
Field What it holds
Message A message about the request as a whole.
Status One of the six request statuses above.
Result.CreatedVendors The vendors that were created.
Result.Errors One entry per object that failed validation, naming the parameter that was invalid.

Success: Status is Completed, Errors is empty, and every vendor you sent is listed in CreatedVendors. The vendors now appear in the Admin Portal under Data management > Vendors.


Field reference

Lengths are the maximum number of characters accepted. Booleans and numbers have no length limit.

Identification and purchasing

These fields land on the vendor’s General information tab.

Field Type Max length Admin Portal field
Name string 100 Name. Mandatory and unique.
VendorId string 100 Vendor ID. Mandatory and unique.
OrderTemplateName string 100 Order template. Mandatory. Must refer to an existing template.
ConsignmentOrderTemplateName string 100 Consignment order template. Mandatory. Must refer to an existing template.
Description string 400 Description. Free text for your own reference.
ShippingNote string 400 Shipping note. The order template can print it on the purchase order.
CustomerNumber string 100 Customer number. Your account number with this vendor.
CustomerShipToID string 60 Default Ship to ID. The vendor’s identifier for your delivery address.
FrameOrderNumber string 100 Frame order number. Added as the purchase order reference on orders a script creates.
DeliveryCondition string 400 Delivery condition.
TermsOfPayment string 400 Terms of payment.
PurchasingCurrency string 50 Purchasing currency. Must refer to an existing currency.
LeadTime number Lead time, in days.
ServiceLeadTime number Service lead time, in days.
IsInternal boolean Internal. Locked after the vendor is created.
IsManufacturer boolean Is manufacturer. true also creates a manufacturer with the same name.
AllowRestockWithoutOrder boolean Allow restock without purchase order.
AllowOverstockOfNonQuotedItems boolean Allow overstock of non-quoted items.
HasMinimalOrderValue boolean Minimum order value, the checkbox.
MinimalValuePerOrder number The amount behind Minimum order value.
IntegrationId string 50 Integration ID on the Integration tab.

Primary contact

The top half of the Address information tab.

Field Type Max length Admin Portal field
PrimaryEmailAddress string 100 Primary E-mail address.
WebAddress string 400 Web address.
PrimaryPhone string 100 Primary phone.
FaxNumber string 100 Fax number.

AddressInformations

An array. Each object becomes one row in the Address grid on the Address information tab.

Field Type Max length Admin Portal field
Street string 100 Street. Mandatory — the only mandatory field in an address.
StreetNumber string 50 The unlabelled box to the right of Street.
PostalCode string 50 Postal code.
City string 100 City.
CountryCode string 2 Country, as a two-letter country code.
Comment string 400 Comment.

ContactPersons

An array. Each object becomes one row on the Contact person tab.

Field Type Max length Admin Portal field
Surname string 100 Surname. Mandatory — the only mandatory field in a contact person.
Name string 100 Name.
Email string 100 E-mail.
Phone string 100 Phone.
Mobile string 100 Mobile no.
Position string 100 Position.

Notifications

Vendor notifications email the recipients you list about purchasing events for this one vendor. They are sent in addition to the system-level notifications, not instead of them.

Field Type Max length Admin Portal field
IsNotificationEnabled boolean Set custom vendor notifications. The other notification fields do nothing until this is true.
NotificationEmails array of string 100 each E-mails, the recipient list.
NotificationNewSuggestedOrder boolean New suggested order.
NotificationOrderSent boolean Order sent.
NotificationOrderCancelled boolean Order canceled. The Admin Portal spells the label with one l; the field name has two.
NotificationLateOrder boolean Order is late.
NotificationScrappedServiceItem boolean Service item scrapped.

What this interface cannot set

A vendor created here is complete enough to buy from, but a few settings have no field in the schema. Set them in the Admin Portal afterwards.

Setting Where it is
Maximum order value General information tab. Only the minimum order value is exposed.
Default order ID prefix General information tab.
Sending of order failed notification Notifications tab. The other five events are exposed.
Consignment invoicing schedule and distribution channels Consignment invoicing tab.
B2B mode, web service, FTP, and e-mail integration channels Integration tab. Only IntegrationId is exposed.

Next steps

  1. Finish the vendor in the Admin Portal — add consignment invoicing, the integration channels, and anything else the schema does not carry. See How to manage vendors.
  2. Create the items you buy from this vendor — an item refers to its vendor by VendorId, so the vendor has to exist first. See How to manage items with the REST API.
  3. Create manufacturers if the supplier does not make the tools it sells. See How to create manufacturers with the REST API.

Troubleshooting

Problem Likely cause Fix
The call answers 200 but no vendor appears in the Admin Portal. Writes are queued. The response only confirms that the request was accepted. Call GetRequestResult with the GUID and read Errors.
Errors names OrderTemplateName or ConsignmentOrderTemplateName. The name does not match an order template of type Order. Copy the name from Administration > System settings > Purchase > Order templates, exactly as it is written there.
Errors names VendorId or Name. Another vendor already uses that ID or name. Both must be unique. Send a different value, or edit the existing vendor in the Admin Portal instead.
The request is rejected before it is queued. The bearer token is missing, malformed, or expired. Request a new access token with your API key — see How to authenticate with the REST API.
The vendor was created but its purchasing currency is the system default. PurchasingCurrency was left out of the payload. Set the currency on the vendor in the Admin Portal. It cannot be changed once the vendor has items.
The vendor was created with the wrong Internal setting. IsInternal is locked once the vendor exists, and there is no update endpoint. Delete the vendor in the Admin Portal and create it again with the correct value.

Was this article helpful?

Related Articles