# Cortecloud Public API

> What the Cortecloud Public API lets you integrate, staging and production base URLs, and first steps.

Canonical URL: https://apis.cortecloud.com.br/docs/en/

Cortecloud is the platform where **carpenters**, professionals who design and assemble furniture, order custom-cut parts from **service centers**, the companies that sell the materials and produce those parts. The other terms are defined in [Concepts](https://apis.cortecloud.com.br/docs/en/comecando/conceitos.md).

The Public API lets you integrate a service center's system (ERP, sales system, payment checkout) with Cortecloud. With it, your integration can:

- keep the price, stock and active/inactive status of the service center's materials up to date: boards, edge banding and hardware components ([Materials](https://apis.cortecloud.com.br/docs/en/guias/integracao-erp/materiais.md));
- query the service center's services (orders), link them to the orders in your ERP and send them to production ([Get services](https://apis.cortecloud.com.br/docs/en/guias/integracao-erp/obter-servicos.md) and [Update services](https://apis.cortecloud.com.br/docs/en/guias/integracao-erp/atualizar-servicos.md));
- be notified of every status change of a service, without calling `GET /services` over and over ([Webhooks](https://apis.cortecloud.com.br/docs/en/guias/webhooks.md));
- take the online payment for a service in a checkout in your system ([Payment checkout](https://apis.cortecloud.com.br/docs/en/guias/checkout.md));
- open Cortecloud screens already authenticated for salespeople and carpenters, without them typing a username and password ([Embedded login](https://apis.cortecloud.com.br/docs/en/guias/login-embutido.md)).

For developers of furniture design software, the portal also documents the format of the JSON file the carpenter uses to import parts, drilling and machining into a service ([JSON file import](https://apis.cortecloud.com.br/docs/en/guias/importacao-json.md)). That integration is file-based and does not use the API.

## Environments {#ambientes}

| Environment | Base URL |
| --- | --- |
| Staging | `https://apis.hml.cortecloud.com.br` |
| Production | `https://apis.cortecloud.com.br` |

Each environment has its own credentials. The examples use relative paths (`/services`, `/materials/boards`): prefix them with the environment's base URL.

## First steps {#primeiros-passos}

1. Request the credentials (api key and secret key) from suporte@serrabits.com.br. Say that you are an integrator, which service center you will integrate and in which environment. If you do not know the [service center code](https://apis.cortecloud.com.br/docs/en/comecando/conceitos.md#codigo-da-central), ask for it in the same message.
2. Implement request signing following [Authentication](https://apis.cortecloud.com.br/docs/en/comecando/autenticacao.md) and check the result against the [validation values](https://apis.cortecloud.com.br/docs/en/comecando/autenticacao.md#valide-a-sua-implementacao).
3. Read [Errors, limits and pagination](https://apis.cortecloud.com.br/docs/en/comecando/erros-limites-paginacao.md) before writing sync loops.
4. Follow the guide for your use case, first in staging and then in production.

## How this documentation is organized {#como-esta-documentacao-esta-organizada}

- **Guides** (this part): concepts, authentication and the step-by-step for each type of integration.
- **[API reference](https://apis.cortecloud.com.br/docs/swagger)**: Swagger with every route, parameter, body and response. It is the source of truth for the format of each route; the guides point to the corresponding operation.
- **[Playground](https://apis.cortecloud.com.br/docs/playground.html)**: a [Bruno](https://www.usebruno.com/) collection with a sample request for each route, in the staging environment. Opened in Bruno, the collection signs each request by itself. To use it:
  1. open the collection in Bruno with the "Open in Bruno" button;
  2. turn on Bruno's Developer Mode (the signing script uses the `crypto` module);
  3. in the `HML` environment, fill in `apiKey` and `secretKey` as secrets and `companyInternalCode` with the service center code.
