LCSC API Instruction

LCSC API Instruction is mainly for LCSC partners who wish to use our API service to integrate our system with yours. If you have any questions, please send email to support@LCSC.COM.

LCSC API

Introduction

LCSC provides eight API services that allow customers and partners to automate some of the tasks that can be performed on LCSC.COM

You can refer to the API documentation for API integration.

Getting Started

Before using the API service, you will need to complete the following steps:

  1. Create an account at LCSC.COM
  2. Summit applied material including company website, business license (or certificate equivalent to business license), contact information, estimated order quantity, cooperation mode etc.
  3. Apply an API key at LCSC via support@lcsc.com

Request Validation

All requests must involve three parameters to verify whether the request is valid or not:

Parameter Description
key Apply an user ID at LCSC.COM
nonce Random
timestamp The timestamp of the request
signature Signature

Note: Secret cannot be placed in request parameters

Signature verification

LCSC API will verify the request to ensure the security of data.

signature =sha1(key=xxx&nonce=xxx&secret=xxxx&timestamp=xxx)

An example, the data verification for LCSC API

The API key:

The API secret:

The request timestamp:

The 16-bit random string:

Therefore, the string used for the signature is:

The result obtained using sha1 is:

Response Error Code Description

Authorization Errors

Code Field(s) Description (Scenario) Message
5003 - API access not enabled No permission to access this API.
403 IP address IP not whitelisted IP not whitelisted, Contact LCSC representative

Header Validation Errors

Code Field(s) Description (Scenario) Message
4001 key / nonce / timestamp / signature Missing required authentication header field(s). Request header {field} is required.
4002 key The provided API key does not exist or has been disabled. API key is disabled or not found.
4003 timestamp The request timestamp is too old and has expired. Timestamp has expired.
4004 timestamp The request timestamp is not a valid numeric value. Timestamp must be a numeric value.
4005 signature Signature verification failed due to invalid or mismatched parameters. Signature is invalid.
4006 any Invalid type or value provided for a header parameter. Invalid type or value for header parameter '{field}'.

Parameter Validation Errors

Code Field(s) Description (Scenario) Message
4010 keyword The request is missing the required keyword parameter. Keyword is required.
4011 keyword The provided keyword exceeds the maximum length of 500 chars. Keyword must be less than 500 characters.
4012 limit limit is out of range; must be between 1 and 500. Limit must be an integer between 1 and 500.
4013 offset offset value is invalid; must be ≥ 0. Offset must be a non-negative integer.
4014 language The provided language is not supported. Language must be one of: EN, CN.
4015 returnInformation The provided value is not one of the allowed options. ReturnInformation must be one of: ProductInformation, ProductPricing, All.
4016 inStockOnly The provided input is not in the supported list. inStockOnly must be True or False.
4017 currency The provided currency is not in the supported list. Currency must be one of: USD, CNY, EUR, HKD.
4018 lastUpdateTime The provided date format is invalid. Invalid date format for LastUpdateTime.
4019 lastUpdateTime The provided date is later than the current time. LastUpdateTime cannot be later than current time.
4020 lastUpdateTime The lastUpdateTime parameter is missing. LastUpdateTime is required.
4021 categoryId The categoryId parameter is missing. CategoryId is required.
4022 categoryId The given categoryId does not exist. CategoryId does not exist.
4023 changeInformation The provided value is not one of the allowed options. ChangeInformation must be one of: ProductInformation, ProductPricing, All.
4024 offset The provided offset is no longer valid (query conditions changed). Offset has expired.
4025 categoryId The provided categoryId is not a leaf node. Invalid Category ID: It is not a leaf node.
4026 Any field A parameter has an invalid type or value. Invalid type or value for parameter '{field}'.
4027 Any field Input %s paremeter is invalid %s is invalid
4028 isTariffActive isTariffActive input parameter type is not boolean isTariffActive must be true or false
4029 CartCode The card code doesn’t exist Cart does not exist.
4030 cartProducts The maximum count of product in the cart cannot exceed 500, when the cart product is at 499 adding 10 more product to the cart will result failure with none being successful added The current number of shopping carts exceeds the maximum value!
4031 cartProducts When adding product to the cart and all product resulting failure All product additions failed, please ensure the product details are valid and try again.
4032 cartName cartName missing in the input parameter cartName is required.
4033 cartName cartName length exceed 60 characters cartName must be less than 60 characters.
4034 cartProducts cartProducts missing in the input parameter atleast 1 product must be include in the parameter cartProducts is required.
4035 cartProducts For a single addcart scenario a maximum of 50 product is allow cartProducts size must be less than 50
4036 cartCode cartCode missing in the input parameter cartCode is required
4037 cartProductDetailIds For deletetion product from the cart the maximum product cannot exceed 50 cartProductDetailIds size must be less than 50
4038 cartProducts The total number of product in a cart cannot exceed maximum of 500 Shopping cart items exceeded! The number of items in your shopping cart exceeds the 500 maximum. Please reduce some items & try again

Rate Limit Errors

Code Field(s) Description (Scenario) Message
429 - The client sent too many requests in one minute. The client sent too many requests in one minute.
430 - The client exceeded the daily request quota. The client exceeded the daily request quota.

System Errors

Code Field(s) Description (Scenario) Message
5001 - An internal server error occurred (e.g., downstream service failure). Internal server error. Please try again later.
5002 - The request was rejected because the IP is not authorized (e.g., IP not in whitelist). The request IP is not authorized.

Summary

Response Data Format

All of the API services response as the following format. No repetitive description in specific API.

JSON Element Description
success Successful call value is "true" and unsuccessful one is "false"
code Status code
message Error message
key The user ID applied at LCSC.COM
result Result of response

API Terms of Use

By using the LCSC APIs, you agree the Return Policy (https://www.lcsc.com/faqs/return-refund/return-and-refund-policy), and Terms of Use as follows:

Failure to comply may result in revocation of access and any other remedy available at law or in equity.