Try it

REST API

Sortyra team · · 10 min read

The REST API lets your systems – an ERP, an internal tool or a script – manage sources, outputs, rules, the category tree and output settings in Sortyra, read and edit products and start recalculation without opening the app. Access is controlled by API keys with a precisely defined permission scope, which you can revoke at any time.

What this feature does

You control the Sortyra app with your mouse in a browser. The REST API is a second door into the same app – meant for programs, not people. Your system sends a request to an address (for example "give me the list of outputs") and receives a response in JSON format, which is structured text that a computer can read easily.

The API works with the same data and rules as the app. Whatever you change via the API, you'll see in the app and in Change history with "API" as the author – and you can undo it within 24 hours.

In the API, an output is called a project. It's the same thing as an output in the app – a feed for one channel.

Where to find it

In the System → Integrations and API menu, on the API and MCP keys tab. This is where you create and revoke keys, and the API documentation button opens the technical description of the API in OpenAPI 3.1 format: /api/v1/openapi.json. Keys are created by the owner or an administrator. You can see every call (without the content of the request) on the Call log tab.

The API is part of the subscription. During the free trial it returns at most 10 products, just like the output preview.

Step by step: creating a key

  1. Open Integrations and API, the API and MCP keys tab and click New key (or New API key in the top bar).
  2. In Key name, write where you'll use it – for example "ERP warehouse" or "agency script". That makes it easier to tell later which one to revoke.
  3. In the Scope field, choose the permission:
  • read-only – reading outputs, sources, products, rules, the category tree and settings,
  • read and edit – additionally manual product edits, rules, adding and editing sources, category assignment and starting runs,
  • full management (sources, outputs, settings – owner only) – additionally creating, editing and deleting outputs and their settings, deleting sources and uploading the category tree; only the owner can create it.
  1. Click Create key.
  2. Copy the key (it starts with fc_) straight away. It is shown only once – Sortyra can't show it to you again.
  3. In your system, send the key in the Authorization: Bearer fc_… header.

For each key you can see its scope, which feeds it has access to and when it was last used. The Revoke button blocks it immediately – apps using it lose access.

Available endpoints

The base address is https://app.sortyra.com/api/v1. The Scope column shows the lowest key scope that is enough for the call.

Outputs

Method and endpointWhat it doesScope
GET /projectsList of outputs: channel, number of products, last export, feed address.read
POST /projectsCreates an output for a channel from sources (name, channel, sourceIds, optionally locale and dedupe) and returns the projectId and feed address.full management
GET /projects/{id}Output detail including its settings.read
PATCH /projects/{id}Changes the name, sources, language, on/off state, drop threshold or duplicate merging; the output is recalculated.full management
DELETE /projects/{id}?confirmName=…Moves the output to the bin; the exact output name is required as confirmation.full management
GET /projects/{id}/optionsOutput settings (currency, country, file name, GZIP, shipping, recalculation times…) and the feed address.read
PATCH /projects/{id}/optionsChanges only the settings you send as {"options": {…}}; a null value clears a setting.full management
PUT /projects/{id}/mappingField mapping for a channel with its own structure: channel field → product field, parameter or template.edit
POST /projects/{id}/runStarts recalculation and export of the output.edit

Sources

Method and endpointWhat it doesScope
GET /sourcesList of sources and their status (secret parts of addresses are hidden).read
POST /sources/inspectPreview of a feed from its address: format, fields and suggested mapping. Saves nothing.edit
POST /sourcesAdds a source with the suggested (optionally adjusted) mapping and downloads it straight away.edit
GET /sources/{id}Source detail: mapping, download schedule, status.read
PATCH /sources/{id}Changes the name, address, number or exact times of downloads, priority, on/off state and other source options.edit
DELETE /sources/{id}Moves the source to the bin and disconnects it from outputs.full management
POST /sources/{id}/fetchDownloads the source right now (at most once every 15 minutes).edit
GET /sources/{id}/runsDownload history: result, counts, duration and error.read
GET /sources/{id}/inputImport adjustments: currency, exchange rate, VAT, excluded categories, allowed brands, price cap, approval of new products.read
PATCH /sources/{id}/inputChanges only the import adjustments you send; outputs are recalculated.edit

Products

Method and endpointWhat it doesScope
GET /products?projectId=…The output's products after rules; filters q, status, sourceId, pagination limit (at most 500) and offset.read
GET /products/{id}?projectId=…Product detail: input, output, edits, history, rule trace.read
PATCH /productsManual edit of a field for one or more products, locked by default.edit

Rules

Method and endpointWhat it doesScope
GET /rules?projectId=…The output's rules in order of execution.read
POST /rulesCreates a rule.edit
PATCH /rules/{id}Changes a rule's definition, on/off state, source restriction or group.edit
DELETE /rules/{id}Deletes a rule.edit
PUT /rules/orderSets a new order for the output's rules.edit
POST /rules/dry-runA test run of proposed rules without saving: how many products will change or be hidden, with examples.read

Category tree and mapping

Method and endpointWhat it doesScope
GET /categories/treePaths of the shop's category tree.read
PUT /categories/treeReplaces the shop's category tree with new paths in the form "A > B > C".full management
GET /categories/proposalsSuggested tree categories for uncategorised products, grouped by supplier category.read
POST /categories/proposalsAssigns a supplier category's products to a tree category and remembers it for new products; only a full management key can add a new category to the tree.edit
GET /categories/taxonomy?tree=…&q=…Searches a channel's taxonomy by text and returns the category ID and path.read
GET /categories/channel?projectId=…&taxonomy=…Shop categories in the output with the assigned channel category and number of products.read
PUT /categories/channelAssigns a channel category to a shop category – for all outputs or just one.edit

The status parameter for products takes the values visible, hidden, no_ean (without EAN), no_category (without category), locked (manually edited) warnings (with a rule error), awaiting_approval (awaiting approval) and input_excluded (excluded at input).

Other endpoints – for example supplier categories, the range of an output's categories or image templates – are described in the technical OpenAPI description.

Example calls

List of outputs:

curl -H "Authorization: Bearer fc_YOUR_KEY" https://app.sortyra.com/api/v1/projects

Changing the price of a tent with a lock, so rules don't overwrite it:

curl -X PATCH https://app.sortyra.com/api/v1/products \
  -H "Authorization: Bearer fc_YOUR_KEY" -H "Content-Type: application/json" \
  -d '{"productIds":["…"],"field":"PRICE_VAT","value":"249.90","locked":true}'

Adding a source – Sortyra detects the feed's format and fields and downloads the source straight away:

curl -X POST https://app.sortyra.com/api/v1/sources \
  -H "Authorization: Bearer fc_YOUR_KEY" -H "Content-Type: application/json" \
  -d '{"name":"Tent supplier","url":"https://supplier.sortyra.com/feed.xml","updatesPerDay":4}'

Creating a Google output from that source and changing its currency:

curl -X POST https://app.sortyra.com/api/v1/projects \
  -H "Authorization: Bearer fc_YOUR_KEY" -H "Content-Type: application/json" \
  -d '{"name":"Google CZ","channel":"google","sourceIds":["…"],"locale":"cz"}'

curl -X PATCH https://app.sortyra.com/api/v1/projects/OUTPUT_ID/options \
  -H "Authorization: Bearer fc_YOUR_KEY" -H "Content-Type: application/json" \
  -d '{"options":{"currency":"CZK","country":"CZ"}}'

Fields have the same names as in the app, for example NAME, PRICE_VAT, EAN, MANUFACTURER or PARAM:Colour. If you add projectId, the edit applies only to that output. The easiest way to find out the rule format is to read rules created in the app via GET /rules.

Error codes

CodeMeaning
401The API key is missing or invalid.
402The REST API is not included in the organisation's plan, or the subscription has ended.
403The key doesn't have permission (for example it's read-only); the scope field in the response says which scope is needed.
404The record doesn't exist or you don't have access to it.
422Invalid request, for example projectId is missing; the issues field lists the invalid fields.
429Too many requests – try again in a minute.

Errors always take the form {"error": "description"}.

Examples

  • Your ERP sends prices: after a price list change, your system sets the new prices via PATCH /products and calls POST /projects/{id}/run.
  • Agency: every morning a script reads GET /projects for all clients and checks the date of the last export.
  • New agency client: a script with a full management key adds the client's feed via POST /sources, creates an output via POST /projects and configures it via PATCH /projects/{id}/options.
  • Quality control: an internal tool uses status=no_ean to list products without an EAN for the purchasing team.
  • A safe rule: a developer first sends a new rule to POST /rules/dry-run, checks the effect and only then saves it via POST /rules.
  • Alerts into your system: you don't read events (source error, unpublished output) via the API – you receive them by webhook.

Tips and common mistakes

  • Grant as few rights as possible. A read-only key is enough for reports.
  • One key per system. If a key leaks, you only need to revoke that one.
  • Locked fields are not overwritten by rules or a new feed. More in Manual edits and locked fields.
  • For an AI agent, use MCP instead – the keys and permissions are the same.
  • Send technical questions to support@sortyra.com. See also the API on our website.

Frequently asked questions

Does Sortyra have an API?

Yes, a REST API with keys and precise permissions. It's part of the subscription, and you'll find its description at /api/v1/openapi.json.

How do I create an API key?

In Integrations and API → API and MCP keys, click New key, enter a name, choose a scope and click Create key. The key is shown only once, so copy it straight away.

Can I change product prices via the API?

Yes, with a read and edit key via PATCH /products with the PRICE_VAT field. The edit is recorded in Change history and can be undone.

Can I create a source or an output via the API?

Yes. You add a source via POST /sources with a read and edit key, and create an output via POST /projects with a full management key. You can also change output settings, rules and the category tree via the API.

Why does the API return only 10 products?

During the free trial, the API returns at most 10 products. Once you pay for a subscription, you have full access.

What if a key leaks?

In Integrations and API → API and MCP keys, click Revoke next to the key. It stops working immediately.

Try it on your own feed