Skip to main content

Manage In-App Products with the API

Use these APIs to retrieve, create, or update your app's products from your server. Call these services only server to server.

Security

Send requests from your server. Do not put the X-Access-Token in a client app; exposing it could allow the app's access to be misused.

Authentication​

For every request, obtain the app access token from the Developer Panel and send it in the X-Access-Token header. In the examples, {PACKAGE_NAME} is your app's package name.

List products​

curl --request GET \
'https://developer.myket.ir/api/partners/applications/{PACKAGE_NAME}/products?limit=10&offset=0' \
--header 'X-Access-Token: {ACCESS_TOKEN}'
  • limit: Number of products in the response; defaults to 100 and has a maximum of 1000.
  • offset: Page offset; defaults to 0, which is the first page.

Example response:

{
"skus": [
{
"skuId": "GEM1",
"farsiTitle": "الماس مرحله اول",
"price": 10000,
"creationDate": "2024-07-27T00:00:05.41",
"isActive": true
}
],
"totalCount": 1
}

Create a product​

To create a consumable in-app product, send this POST request:

curl --request POST \
'https://developer.myket.ir/api/partners/applications/{PACKAGE_NAME}/products' \
--header 'X-Access-Token: {ACCESS_TOKEN}' \
--header 'Content-Type: application/json' \
--data '{
"skuId": "100GOLD2000",
"farsiTitle": "صد طلا",
"price": 20000,
"isActive": false
}'

Create products in a batch​

Create up to 200 in-app products in one request. Send the products directly as a JSON array.

Endpoint​

POST https://developer.myket.ir/api/partners/applications/{PACKAGE_NAME}/products/batch

Replace {PACKAGE_NAME} with your app's package name.

Request structure​

Request headers:

X-Access-Token: {ACCESS_TOKEN}
Content-Type: application/json

The request body must be a direct array of products:

[
{
"skuId": "COINS_100",
"farsiTitle": "بسته ۱۰۰ سکه",
"price": 10000,
"isActive": true
},
{
"skuId": "COINS_500",
"farsiTitle": "بسته ۵۰۰ سکه",
"price": 50000,
"isActive": false
}
]

Do not send AccountId or the package name in the body. The developer account is determined by the access token, and the package name comes from the request path.

Fields for each product​

FieldTypeRequiredDescription
skuIdstringYesUnique product ID within the app; up to 100 characters
farsiTitlestringYesPersian product title; up to 150 characters
priceIntegerYesPrice in rials; minimum 1,000 and maximum 2,000,000,000 rials
isActivebooleanNoWhether the product is active; defaults to false if omitted

Example request​

curl --request POST \
'https://developer.myket.ir/api/partners/applications/{PACKAGE_NAME}/products/batch' \
--header 'X-Access-Token: {ACCESS_TOKEN}' \
--header 'Content-Type: application/json' \
--data '[
{
"skuId": "COINS_100",
"farsiTitle": "بسته ۱۰۰ سکه",
"price": 10000,
"isActive": true
},
{
"skuId": "COINS_500",
"farsiTitle": "بسته ۵۰۰ سکه",
"price": 50000,
"isActive": false
}
]'

Limits and validation​

  • Each request must contain at least one and at most 200 products. Split larger sets into separate requests.
  • IDs must not repeat within the array. This duplicate check is case-insensitive: COINS_100 and coins_100 count as duplicates.
  • None of the IDs may already exist for the app; inactive products are included in this check.
  • Every product must meet the field constraints above. A null array entry is not accepted.
  • This service creates new products. Use the update service to change an existing product.

Product validity and duplicate IDs are checked before inserting SKUs. If even one product is invalid or conflicts with an existing product, the entire request is rejected and none of its new products are created.

For example, if the last ID in a batch of 10 products already exists, the other nine products are not created either.

Successful response​

On successful creation, the service returns 200 OK and a success message. Use the list-products service to view the created products:

GET https://developer.myket.ir/api/partners/applications/{PACKAGE_NAME}/products

Possible errors​

HTTP statusError codeCause
400SkuListIsRequiredThe product list is empty
400SkuBatchLimitExceededMore than 200 products were sent
400SkuIdIsDuplicateAn ID repeats within the array or already exists for the app
400SkuIdIsRequiredThe product ID is missing or empty
400SkuIdMaxLengthExceededThe product ID exceeds 100 characters
400SkuTitleIsRequiredThe Persian title is missing or empty
400SkuTitleMaxLengthExceededThe Persian title exceeds 150 characters
400SkuPriceMinValueNotReachedThe price is below 1,000 rials or missing
400SkuPriceMaxValueExceededThe price exceeds 2 billion rials
400InValidSkuFormatProduct data is invalid, for example a null array entry
401—The token is invalid or does not have access to the app
500—An internal error occurred while processing the request

A non-JSON body or a structure incompatible with an array of products also returns 400.

If you receive 500 or the connection drops before a response arrives, check the product list before retrying. A missing success response alone does not mean the products were not created.

Update a product​

To update a product, include its ID in the path and send only the fields you want to change:

curl --request PUT \
'https://developer.myket.ir/api/partners/applications/{PACKAGE_NAME}/products/{SKU_ID}' \
--header 'X-Access-Token: {ACCESS_TOKEN}' \
--header 'Content-Type: application/json' \
--data '{
"farsiTitle": "صد طلا",
"price": 20000,
"isActive": true
}'

Product fields​

FieldDescription
skuIdUnique product ID; required on creation, up to 100 characters
farsiTitlePersian title; required on creation, up to 150 characters
pricePrice in rials; required on creation, at least 1,000 rials
isActiveWhether the product is active; defaults to false when created

A successful response returns code 200 and a success message. An invalid token or package name may result in 401 Unauthorized. Invalid requests, duplicate IDs, and values outside the allowed limits also return errors.