Skip to main content
Vendor Update API
curl --request PATCH \
  --url https://api.pazy.io/v1.0/vendor/:vendorId

Documentation Index

Fetch the complete documentation index at: https://docs.pazy.io/llms.txt

Use this file to discover all available pages before exploring further.

Authentication

All requests require an API key in the request headers. Headers:
Authorization: Api-Key YOUR_API_KEY
Content-Type: application/json

Request

Content-Type: application/json

Path Parameters

ParameterTypeRequiredDescription
vendorIdstringYesUnique identifier of the vendor to update

Body Parameters

The request body has a single top-level key, vendorData. All fields inside vendorData are optional — only the fields you include will be considered for update. Fields you omit are left untouched.
ParameterTypeRequiredDescription
vendorDataobjectYesContainer for the partial update payload
vendorData.namestringNoVendor display name (1–255 characters)
vendorData.emailstringNoVendor email address (must be a valid email format)
vendorData.phonestringNoVendor phone number — must include country code in +{country_code}{number} format (e.g., +919876543210)
vendorData.ownerstringNoNew owner — pass a user id / slug of a user in your organization
vendorData.addressobjectNoVendor address. Existing address fields are merged with the values you send. See Address Fields below.
vendorData.communicationsobjectNoPayment confirmation email recipients. See Communications Fields below.
vendorData.customFieldsobjectNoMap of flex-field slug → { type, value }. See Custom Fields below.

Address Fields

vendorData.address accepts the following properties (all optional, merged with existing values):
FieldTypeDescription
addressLine1stringAddress line 1
addressLine2stringAddress line 2
citystringCity
statestringState
zipCodestringPostal / ZIP code
pinCodestringPostal / PIN code (alias preferred by the persistence layer)
countrystringCountry
localitystringDOMESTIC or INTERNATIONAL

Communications Fields

vendorData.communications configures who receives payment confirmation emails. Each list contains user ids / slugs from your organization.
FieldTypeDescription
toarray of strings”To” recipients (user ids)
ccarray of strings”CC” recipients (user ids)
bccarray of strings”BCC” recipients (user ids)

Custom Fields

vendorData.customFields is a map keyed by the flex-field slug configured for your organization. Each value is an object with type and value:
FieldTypeDescription
typestringFlex-field type. Must match the field definition. One of VARCHAR, DATETIME, DROPDOWN, NUMERIC
valuestring | numberVARCHAR: text; DATETIME: date in YYYY-MM-DD; DROPDOWN: tag value id; NUMERIC: a number

Code Examples

curl -X PATCH https://api.pazy.io/v1.0/vendor/<vendorId> \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "vendorData": {
      "name": "Acme Suppliers",
      "email": "vendor@example.com",
      "phone": "+919876543210"
    }
  }'

Success Response

HTTP Status: 200 OK The endpoint always returns 200 OK when the request itself is valid — even when individual fields fail to update. Inspect context.updates.<field> to see the per-field outcome. Response Fields:
FieldTypeDescription
okbooleanIndicates whether the request was processed
updatebooleanIndicates that the update operation ran
errorobject | nullTop-level error if the entire request failed (null when per-field results are returned)
contextobjectContainer for per-field results
context.updatesobjectMap keyed by the field name you sent in vendorData
context.updates.<field>.updatebooleantrue if that field was updated; false if it was rejected or skipped
context.updates.<field>.errorobjectPresent only when update is false. Contains a code and message describing the reason.
Some fields attach extra metadata when they fail:
FieldFailure codeExtra fields returned
nameDUPLICATE_VENDOR_NAMEisDuplicate: true, duplicateVendor: { id, name }
communicationsINVALID_USER_IN_COMMUNICATIONSwrongUserSlugs: [...]

Response Example — Successful Multi-Field Update

{
  "ok": true,
  "update": true,
  "error": null,
  "context": {
    "updates": {
      "name": { "update": true },
      "email": { "update": true },
      "phone": { "update": true }
    }
  }
}

Response Example — Mixed Success and Failures

{
  "ok": true,
  "update": true,
  "error": null,
  "context": {
    "updates": {
      "name": {
        "update": false,
        "error": {
          "code": "DUPLICATE_VENDOR_NAME",
          "message": "Vendor with the same name already exist"
        },
        "isDuplicate": true,
        "duplicateVendor": {
          "id": "<otherVendorId>",
          "name": "Acme Trading"
        }
      },
      "phone": {
        "update": false,
        "error": {
          "code": "SAME_VALUE_GIVEN",
          "message": "Phone is same as the current one"
        }
      },
      "owner": { "update": true }
    }
  }
}

Response Example — communications with Unknown Users

{
  "ok": true,
  "update": true,
  "error": null,
  "context": {
    "updates": {
      "communications": {
        "update": false,
        "error": {
          "code": "INVALID_USER_IN_COMMUNICATIONS",
          "message": "ERROR_CODE INVALID_USER_IN_COMMUNICATIONS not found"
        },
        "wrongUserSlugs": ["<unknownUserId>"]
      }
    }
  }
}

Response Example — customFields Mixed Outcome

{
  "ok": true,
  "update": true,
  "error": null,
  "context": {
    "updates": {
      "customFields": {
        "fasttrack": { "update": true },
        "test-upload": { "update": true },
        "wrong-tag": {
          "update": false,
          "error": {
            "code": "INVALID_TAG",
            "message": "Invalid tag key"
          }
        },
        "hinge": {
          "update": false,
          "error": {
            "code": "INVALID_TAG_TYPE",
            "message": "Tag type is of 'DATETIME' but received VARCHAR"
          }
        }
      }
    }
  }
}

Per-Field Error Codes

FieldError codeWhen it occurs
nameDUPLICATE_VENDOR_NAMEAnother vendor in the same organization already uses this name. Response includes duplicateVendor.id and duplicateVendor.name.
name, email, phone, owner, address, communicationsSAME_VALUE_GIVENThe submitted value matches the existing value — nothing changed
phoneINVALID_NUMBERPhone number does not follow +{country_code}{number}
ownerINVALID_OWNEROwner user id does not exist in your organization
communicationsINVALID_USER_IN_COMMUNICATIONSOne or more of the to / cc / bcc slugs is not a valid user. Invalid ids are returned in wrongUserSlugs.
customFields.<slug>INVALID_TAGThe slug does not match any flex field configured for the organization
customFields.<slug>INVALID_VALUE_IDFor DROPDOWN: the value id is unknown or not linked to that tag
customFields.<slug>INVALID_TAG_TYPEThe type sent does not match the configured flex-field type
customFields.<slug>INVALID_DATE_INPUTFor DATETIME: value is not in YYYY-MM-DD

Error Responses

Validation Error

HTTP Status: 400 Bad Request
{
  "ok": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Validation failed: /vendorData/email: must match format \"email\""
  }
}

Vendor Not Found

HTTP Status: 404 Not Found
{
  "ok": false,
  "error": {
    "code": "VENDOR_NOT_FOUND",
    "message": "Vendor not found"
  }
}

Access Denied

HTTP Status: 403 Forbidden
{
  "ok": false,
  "error": {
    "code": "ACCESS_DENIED",
    "message": "Access denied: You can only view vendors you own"
  }
}
Returned when the caller is neither an admin / bookkeeper nor the vendor’s owner.

Authentication Errors

HTTP Status: 401 Unauthorized
{
  "ok": false,
  "error": {
    "code": "MISSING_CREDENTIALS",
    "message": "Missing Credentials"
  }
}
{
  "ok": false,
  "error": {
    "code": "INVALID_API_KEY",
    "message": "Invalid API Key"
  }
}

Permission Errors

HTTP Status: 403 Forbidden
{
  "ok": false,
  "error": {
    "code": "INSUFFICIENT_PERMISSIONS",
    "message": "Permission check failed - PERMISSION_CHECK_FAILED"
  }
}

Internal Error

HTTP Status: 500 Internal Server Error
{
  "ok": false,
  "error": {
    "code": "INTERNAL_ERROR",
    "message": "Internal error"
  }
}

Best Practices

  • Send only the fields you want to change — omitted fields are left untouched
  • Always inspect context.updates.<field> for the outcome; a 200 OK does not guarantee every field was applied
  • For phone, normalize to E.164 (+{country_code}{number}) before sending — values without + are rejected with INVALID_NUMBER
  • For address, the API merges with the existing record. Send only the keys you want to change rather than the full address
  • For customFields, the type you send must exactly match the field’s configured type — a mismatch is rejected per-field with INVALID_TAG_TYPE
  • Use the Vendor Details API to fetch the current state, and the Vendor Audit Trail API to inspect change history after updates