<?php
$page_lang = 'en';
$page_title = 'REST API: integration for enterprise clients | Corp-Merch.MX';
$page_description = 'REST API: quotes, orders, status, invoices and webhooks with bearer-token authentication, JSON format and examples in curl, Python and Node.js.';
$og_image = '/assets/images/og-sdk.png';
$page_section = 'sdk';
$page_slug    = 'api-integration';

$labels = [
    'name' => 'Name', 'name_placeholder' => 'Your name',
    'contact' => 'Work email', 'contact_placeholder' => 'name@company.com',
    'company' => 'Company', 'company_placeholder' => 'Legal entity name',
    'message' => 'Brief', 'message_placeholder' => 'Operations stack, expected volume, required integrations...',
    'submit' => 'Request SDK access', 'sending' => 'Sending...',
    'turnstile_error' => 'Verify you are not a robot'
];

require __DIR__ . '/../../../includes/header.php';
?>
<link rel="alternate" hreflang="es" href="https://corp-merch.com.mx/es/pages/sdk/api-integration">
<link rel="alternate" hreflang="en" href="https://corp-merch.com.mx/en/pages/sdk/api-integration">
<link rel="alternate" hreflang="ru" href="https://corp-merch.com.mx/ru/pages/sdk/api-integration">
<nav class="breadcrumbs"><a href="/en/">Home</a><span class="sep">&rsaquo;</span><a href="/en/pages/sdk/">SDK</a><span class="sep">&rsaquo;</span><span>REST API</span></nav>

<section class="hero">
  <div class="container">
    <div class="hero-content">
      <p class="eyebrow">REST · JSON · Bearer · OpenAPI 3.0</p>
      <h1>REST API for enterprise clients</h1>
      <p class="hero-subtitle">The REST API that lets you wire quotes, orders, production status, deliveries and invoices into your own operations stack — ERP, customer portal, service desk. Documented in OpenAPI 3.0 with examples in curl, Python and Node.js. Access is granted to clients on an active programme with a signed usage agreement.</p>
      <div class="hero-cta"><a href="#contact-form" class="btn btn-primary">Request SDK access</a></div>
    </div>
  </div>
</section>

<section class="section"><div class="container">
  <h2>Basics: authentication, base URL, format</h2>
  <p>The API authenticates with a bearer token we issue to you with your programme. The token rotates every ninety days or on your request. The production base URL is <code>https://api.corp-merch.com.mx/v1</code>. The sandbox base URL is <code>https://sandbox.api.corp-merch.com.mx/v1</code>. The sandbox carries fictitious data and resets every Monday at midnight GMT-6.</p>
  <p>The exchange format is JSON with UTF-8. Dates and times are handled in ISO 8601 with timezone — we prefer <code>YYYY-MM-DDTHH:MM:SS-06:00</code> for CDMX time. Amounts are in MXN cents — to represent fifty pesos fifty centavos you send <code>5050</code>. Country codes are ISO 3166-1 alpha-2 — <code>MX</code> for Mexico, <code>US</code> for United States, <code>CA</code> for Canada.</p>
</div></section>

<section class="section section-alt"><div class="container">
  <h2>Main endpoints</h2>
  <p>The API exposes six endpoint blocks. The quotes block: <code>POST /quotes</code> to create a quote, <code>GET /quotes/{id}</code> for the detail, <code>POST /quotes/{id}/approve</code> to approve, <code>POST /quotes/{id}/reject</code> to reject with reason. The orders block: <code>POST /orders</code> to create an order from an approved quote, <code>GET /orders/{id}</code> for the detail, <code>PATCH /orders/{id}</code> to update allowed fields before production, <code>POST /orders/{id}/cancel</code> to cancel before production.</p>
  <p>The status block: <code>GET /orders/{id}/status</code> for the full status, <code>GET /orders/{id}/status/history</code> for the timestamped history, <code>GET /orders/{id}/documents</code> for associated documents. The shipments block: <code>GET /orders/{id}/shipments</code> to list shipments, <code>GET /shipments/{id}</code> for the detail, <code>POST /shipments/{id}/confirm</code> to confirm receipt when the customer signs. The invoices block: <code>GET /orders/{id}/invoices</code> to list, <code>GET /invoices/{id}</code> for the detail with CFDI 4.0 XML and PDF. The catalogue block: <code>GET /catalog/products</code> to list products, <code>GET /catalog/products/{id}</code> for detail with prices and stock.</p>
</div></section>

<section class="section"><div class="container">
  <h2>Example: creating a quote</h2>
  <p>To create a quote, send a <code>POST</code> request to <code>/v1/quotes</code> with the bearer token in the <code>Authorization</code> header and a JSON body with the products, quantities, decoration technique and lead times. The endpoint returns a quote identifier and the detail with prices in MXN cents before VAT, broken-down VAT, total and per-line lead time.</p>
  <p>The minimum body for a quote includes a lines array with <code>product_id</code>, <code>quantity</code>, <code>decoration</code> with the technique — <code>screen</code>, <code>dtf</code>, <code>embroidery</code>, <code>laser</code> — and <code>delivery_address</code> with the full address. For lines with variable personalisation — joiner number, individual size — include the <code>variables</code> array per line. The quote is delivered within a minute when the catalogue recognises the product and the address falls within coverage.</p>
</div></section>

<section class="section section-alt"><div class="container">
  <h2>Example: checking order status</h2>
  <p>To check status, send a <code>GET</code> to <code>/v1/orders/{id}/status</code> with the bearer token. The endpoint returns the current status — <code>created</code>, <code>approved</code>, <code>in_production</code>, <code>quality_check</code>, <code>packed</code>, <code>shipped</code>, <code>delivered</code>, <code>invoiced</code>, <code>closed</code>, <code>canceled</code> — and progress percentage per stage. The response includes the estimated delivery date based on the customer's and the workshop's calendar.</p>
  <p>For runs with multiple stages — cutting, sewing, decoration, packing, shipping, delivery — the customer gets the breakdown per stage with progress percentage. When a stage slips, status returns the reason — raw material shortage, non-conformance, awaiting customer confirmation — and the updated estimated date. The integration stays consistent with the webhooks that fire on status changes.</p>
</div></section>

<section class="section"><div class="container">
  <h2>Error handling and retries</h2>
  <p>Errors return standard HTTP codes — <code>400</code> for malformed request, <code>401</code> for missing or invalid token, <code>403</code> for resource not allowed, <code>404</code> for resource not found, <code>409</code> for state conflict, <code>422</code> for validation failure, <code>429</code> for rate exceeded, <code>500</code> for internal error. The error body includes <code>code</code> with the machine-readable code, <code>message</code> with the human-readable description and <code>details</code> with the array of fields in error where applicable.</p>
  <p>The rate limit is sixty requests per minute per token and one thousand requests per hour per token. When the limit is exceeded, the endpoint returns <code>429</code> with the <code>Retry-After</code> header indicating seconds to wait. We implement exponential backoff on the client with jitter to avoid the thundering herd effect. For customers with higher volume we negotiate a higher limit at programme start.</p>
</div></section>

<section class="section section-alt"><div class="container">
  <h2>Integration best practices</h2>
  <p>We recommend three practices. First, use the sandbox for development and testing before moving to production. The sandbox has fictitious data and resets every Monday. Second, subscribe to webhooks instead of polling status — webhooks fire on status change without the customer having to poll. Third, validate the HMAC SHA-256 signatures of webhooks before processing the body to confirm the webhook comes from the API.</p>
  <p>For customers on serverless stacks, webhooks sign the body and are delivered with timestamp and event-identifier headers. The customer must validate the signature, the timestamp — within five minutes — and the identifier to avoid duplicates on retry. The full documentation includes a reference section with available events and body format.</p>
</div></section>

<section class="section"><div class="container">
  <h2>Support and observability</h2>
  <p>For customers with production integration we assign a workshop technical lead who responds to integration questions within four business hours and joins pair programming sessions when required. The technical lead also handles incidents — missed webhook response, drift between portal and API, unexpected response questions.</p>
  <p>The API publishes operational metrics — availability, p95 latency, error rate — on a status dashboard customers can subscribe to. For customers with strict SLA — banking, fintech, government — we deliver a dedicated dashboard with real-time metrics and a direct communication channel for critical incidents. The status page is accessible without authentication.</p>
</div></section>

<section id="contact-form" class="section section-alt"><div class="container">
  <h2>Request SDK access</h2>
  <p>If your technical team needs SDK access to integrate quotes, orders, status, deliveries or invoices with your operations stack, let's talk. We deliver the bearer token, sandbox access and full documentation in your format.</p>
  <?php require __DIR__ . '/../../../includes/form.php'; ?>
</div></section>

<section class="section role-note"><div class="container">
  <p class="role-note-text">The REST API and SDK are delivered to clients on an active programme with a signed usage agreement. Documentation may update without prior notice; major versions are communicated with thirty days' notice. Corp-Merch.MX is a Mexican workshop for corporate merch; we operate independently.</p>
</div></section>

<script type="application/ld+json">
{"@context":"https://schema.org","@type":"WebPage","name":"REST API Corp-Merch.MX","description":"REST API for enterprise integration: quotes, orders, status, invoices and webhooks. Documented in OpenAPI 3.0.","publisher":{"@type":"Organization","name":"Corp-Merch.MX"}}
</script>
<?php require __DIR__ . '/../../../includes/footer.php'; ?>