Quick Start
The PICPIK API adopts an instruction-based style, where each API request contains an instruction (Action
), instruction parameters, and authentication information (PublicKey
, Signature
). All interfaces default to the POST method and use the application/json
request content format.
Please view the Pricing page for charging details.
We offer 300 free credits per user for testing.
Common Request Parameters
Common request parameters are required for all API calls and are usually displayed at the top of the request parameters list in the API reference.
Parameter Name | Type | Description | Required |
---|---|---|---|
Action | String | The corresponding API instruction name | ✓ |
PublicKey | String | User's public key, which can be obtained from the PICPIK User Center (opens in a new tab) | ✓ |
Signature | String | User's signature generated based on the public key and API instruction, see Signature for details | ✓ |
request_uuid | String | Request UUID, randomly generated by using the UUID generation method. This parameter can be utilized to manage the requests of your business and clients. |
Common Response Fields
Common responses are fields to be returned by all APIs and are usually displayed at the top of the response fields list in the API reference.
Field Name | Type | Description | Required |
---|---|---|---|
RetCode | Int | Return status code: 0 indicates a successful return, while non-zero indicates a failure | ✓ |
Action | String | Instruction name | ✓ |
Message | String | The error message is returned when RetCode is non-zero, providing a detailed description | |
request_uuid | String | Returns the UUID that was included in the request |
Quick Start
1. Obtain the keys
Obtain the API keys from the PICPIK User Center (opens in a new tab), including PublicKey
and PrivateKey
.
2. Data preparation
In this example, assume that:
PublicKey = "abcdefg"
PrivateKey = "123456"
Assume the user's request parameters are as follows:
{
"Action": "ListModels",
"PublicKey": "abcdefg"
}
3. Calculate the Signature
Refer to the Signature Algorithm documentation to calculate the signature, in this case, which is:
4a20bc1141494035f6aaaad13224c94c5a8bc3a5
4. Determine the request address
The addresses of different sites' requests are not the same. All request examples in the API docs are for the global site:
Site | Request Address |
---|---|
Global | https://api.picpik.ai |
Chinese Mainland | https://api.picpikai.com |
5. Construct the request
Finally, the constructed request is:
curl -X POST \
https://api.picpik.ai \
-H 'Content-Type: application/json' \
-d '{
"Action" : "ListModels",
"PublicKey" : "abcdefg",
"Signature" : "4a20bc1141494035f6aaaad13224c94c5a8bc3a5"
}'