Custom Safety Products API Documentation

Detailed endpoint reference with authorization, request payloads, sample responses, and table-based parameter documentation.

Overview

All API endpoints are served by Laravel under the `api` route group and use store key authentication. Include both required headers on every request.

Authentication

HeaderDescription
X-Store-Key32-character store authentication key
X-Store-HashStore identifier hash used to resolve the store

Common response

{
  "success": true,
  "message": "...",
  "data": { ... }
}

Endpoint summary

POST

Configure Store

/api/stores/configure

Register or update CSP credentials for the store. First-time calls will create the store and register the key.

POST

Generate Token

/api/stores/generate-token

Generate a backward-compatible token for the store.

POST

Save Design

/api/design/save

Save or update design metadata in the local database.

GET

Design Details

/api/design/details/{design_id}

Retrieve stored design details, optionally syncing with CSP.

POST

Update Quantities

/api/design/update-quantities

Update design item quantities and propagate changes to CSP.

POST

Duplicate Design

/api/design/duplicate

Duplicate one or more designs in CSP and store the new records locally.

GET

Design Proof

/api/design/proof/{design_id}

Retrieve the proof URL for a design associated with an order.

GET

Design Files

/api/design/files/{design_id}

Retrieve ZIP URL and legacy metadata for design files.

POST

Create Print File

/api/design/print-file

Create a print-ready file for a design.

POST

Create Sheet Label

/api/design/sheet-label

Generate a sheet label for a design using a template.

POST

Update PO Number

/api/design/update-po

Update the purchase order number for a design.

POST

Place Order

/api/order/place

Place an order for one or more designs with customer details.

Endpoint details

POST

/api/stores/configure

Register or update CSP configuration for the store. If the store does not yet exist, this endpoint will create it and store the key.

Authorization

HeaderRequired
X-Store-KeyYes
X-Store-HashYes

Parameters

ParameterTypeDescription
is_first_timebooleanOptional. Set true for first-time setup so the store key is registered.
store_namestringOptional. Friendly name for the store.
store_urlurlOptional. Store website URL.
csp_api_endpointurlRequired. CSP API base endpoint.
csp_api_userstringRequired. CSP API username.
csp_api_passwordstringRequired. CSP API password.

Request example

{
  "is_first_time": true,
  "store_name": "My Store",
  "store_url": "https://example.com",
  "csp_api_endpoint": "https://csp.example.com/api",
  "csp_api_user": "apiuser",
  "csp_api_password": "apipassword"
}

Success response

{
  "success": true,
  "message": "Store configuration saved and store key registered successfully",
  "data": {
    "store_id": 123,
    "store_hash": "abc123...",
    "is_first_time": true
  }
}
POST

/api/stores/generate-token

Generate a store token while still using the standard store key authentication headers.

Authorization

HeaderRequired
X-Store-KeyYes
X-Store-HashYes

Parameters

ParameterTypeDescription
token_namestringOptional. Name for the generated token. Defaults to api-token.

Request example

{
  "token_name": "api-token"
}

Success response

{
  "success": true,
  "message": "Token generated successfully",
  "data": {
    "token": "plain-text-token-value",
    "store_id": 123,
    "store_hash": "abc123...",
    "token_name": "api-token"
  }
}
POST

/api/design/save

Save or update a design record in the local database.

Authorization

HeaderRequired
X-Store-KeyYes
X-Store-HashYes

Parameters

ParameterTypeDescription
design_idintegerRequired. Unique design identifier.
product_skustringOptional. Product SKU.
customer_idstringOptional. Customer identifier.
visitor_idstringOptional. Visitor or session identifier.
itemsarrayOptional. Item list for the design.
items.*.skustringRequired when items are provided. Item SKU.
items.*.quantityintegerRequired when items are provided. Item quantity.
items.*.thumbnailurlOptional. Item thumbnail URL.
art_costnumericOptional. Art cost.
decorator_costnumericOptional. Decorator cost.
setup_costnumericOptional. Setup cost.
preview_urlurlOptional. Preview URL.
statusintegerOptional. Design status code.

Request example

{
  "design_id": 456,
  "product_sku": "SKU-001",
  "customer_id": "CUST-123",
  "visitor_id": "VIS-789",
  "items": [
    {
      "sku": "ITEM-001",
      "quantity": 10,
      "thumbnail": "https://example.com/thumb.jpg"
    }
  ],
  "art_cost": 25.50,
  "decorator_cost": 10.00,
  "setup_cost": 5.00,
  "preview_url": "https://example.com/preview.png",
  "status": 1
}

Success response

{
  "success": true,
  "message": "Design saved successfully",
  "data": {
    "id": 789,
    "design_id": 456,
    "store_id": 123
  }
}
GET

/api/design/details/{design_id}

Retrieve stored design details. Use the sync flag to refresh from CSP.

Authorization

HeaderRequired
X-Store-KeyYes
X-Store-HashYes

Parameters

ParameterTypeDescription
design_idpath integerRequired. The design identifier in the URL.
syncbooleanOptional query parameter to refresh data from CSP.

Example request

GET /api/design/details/456?sync=true

Success response

{
  "success": true,
  "data": {
    "design_id": 456,
    "product_sku": "SKU-001",
    "status": 1,
    "job_id": "JOB-123",
    "fees": {
      "art_cost": 25.50,
      "decorator_cost": 10.00,
      "setup_cost": 5.00
    },
    "items": [
      {
        "sku": "ITEM-001",
        "quantity": 10,
        "thumbnail": "https://example.com/thumb.jpg"
      }
    ],
    "preview_url": "https://example.com/preview.png",
    "proof_url": "https://example.com/proof.pdf",
    "created_at": "2026-04-17T12:00:00Z",
    "updated_at": "2026-04-17T12:05:00Z"
  }
}
POST

/api/design/update-quantities

Update item quantities for a design and submit the changes to CSP.

Authorization

HeaderRequired
X-Store-KeyYes
X-Store-HashYes

Parameters

ParameterTypeDescription
design_idintegerRequired. The design ID.
itemsarrayRequired. List of items to update.
items.*.skustringRequired. Item SKU.
items.*.quantityintegerRequired. Quantity for each item.
combine_skus_for_qty_limitsbooleanOptional. Whether to combine SKUs for CSP quantity limits.

Request example

{
  "design_id": 456,
  "items": [
    {
      "sku": "ITEM-001",
      "quantity": 15
    }
  ],
  "combine_skus_for_qty_limits": true
}

Success response

{
  "success": true,
  "message": "Quantities updated successfully",
  "data": {
    "design_id": 456,
    "items": [
      {
        "sku": "ITEM-001",
        "quantity": 15
      }
    ]
  }
}
POST

/api/design/duplicate

Duplicate original designs through CSP and store new design records locally.

Authorization

HeaderRequired
X-Store-KeyYes
X-Store-HashYes

Parameters

ParameterTypeDescription
designsarrayRequired. List of designs to duplicate.
designs.*.design_idintegerRequired. Original design ID.
designs.*.skus_and_qtysarrayRequired. SKU and quantity list for duplication.
designs.*.skus_and_qtys.*.skustringRequired. Item SKU.
designs.*.skus_and_qtys.*.quantityintegerRequired. Item quantity.
reuse_decoratorbooleanOptional. Reuse the decorator during duplication.

Request example

{
  "designs": [
    {
      "design_id": 456,
      "skus_and_qtys": [
        { "sku": "ITEM-001", "quantity": 10 }
      ]
    }
  ],
  "reuse_decorator": false
}

Success response

{
  "success": true,
  "message": "Design(s) duplicated successfully",
  "data": {
    "designs": [
      {
        "old_design_id": 456,
        "new_design_id": 457,
        "fees": {
          "art_cost": 25.50,
          "decorator_cost": 10.00,
          "setup_cost": 5.00
        },
        "items": [
          {
            "sku": "ITEM-001",
            "quantity": 10
          }
        ]
      }
    ]
  }
}
GET

/api/design/proof/{design_id}

Fetch the proof URL for a design using a specific order ID.

Authorization

HeaderRequired
X-Store-KeyYes
X-Store-HashYes

Parameters

ParameterTypeDescription
design_idpath integerRequired. Design ID in the URL.
order_idquery integerRequired. Order ID to retrieve the proof.

Example request

GET /api/design/proof/456?order_id=1001

Success response

{
  "success": true,
  "data": {
    "design_id": 456,
    "order_id": "1001",
    "proof_url": "https://example.com/proof.pdf"
  }
}
GET

/api/design/files/{design_id}

Retrieve ZIP URL and legacy metadata for design files.

Authorization

HeaderRequired
X-Store-KeyYes
X-Store-HashYes

Parameters

ParameterTypeDescription
design_idpath integerRequired. Design ID in the URL.

Example request

GET /api/design/files/456

Success response

{
  "success": true,
  "data": {
    "design_id": 456,
    "zip_url": "https://example.com/design-456-files.zip",
    "is_legacy": false
  }
}
POST

/api/design/print-file

Request creation of a print-ready design file.

Authorization

HeaderRequired
X-Store-KeyYes
X-Store-HashYes

Parameters

ParameterTypeDescription
design_idintegerRequired. Design ID.
job_idintegerOptional. CSP job ID if available.

Request example

{
  "design_id": 456,
  "job_id": 1001
}

Success response

{
  "success": true,
  "data": {
    "design_id": 456,
    "print_file_url": "https://example.com/print-file.pdf"
  }
}
POST

/api/design/sheet-label

Generate a sheet label for a design using a template value.

Authorization

HeaderRequired
X-Store-KeyYes
X-Store-HashYes

Parameters

ParameterTypeDescription
design_idintegerRequired. Design ID.
template_valueintegerRequired. Template value 1-6.

Request example

{
  "design_id": 456,
  "template_value": 2
}

Success response

{
  "success": true,
  "data": {
    "design_id": 456,
    "template_info": {
      "label_url": "https://example.com/label.pdf"
    }
  }
}
POST

/api/design/update-po

Update the purchase order number for a design in CSP.

Authorization

HeaderRequired
X-Store-KeyYes
X-Store-HashYes

Parameters

ParameterTypeDescription
design_idintegerRequired. Design ID.
po_numberstringRequired. Purchase order number.

Request example

{
  "design_id": 456,
  "po_number": "PO-9999"
}

Success response

{
  "success": true,
  "message": "PO number updated successfully"
}
POST

/api/order/place

Place an order for one or more designs with customer details.

Authorization

HeaderRequired
X-Store-KeyYes
X-Store-HashYes

Parameters

ParameterTypeDescription
order_numberstringRequired. Order identifier.
design_idsarray<integer>Required. Design IDs included in the order.
customer.first_namestringRequired. Customer first name.
customer.last_namestringRequired. Customer last name.
customer.address1stringRequired. Street address line 1.
customer.address2stringOptional. Street address line 2.
customer.citystringRequired. City.
customer.regionstringRequired. Region or state.
customer.postal_codestringRequired. Postal code.
customer.countrystringRequired. Country code or name.
customer.emailemailRequired. Contact email.
customer.phonestringOptional. Contact phone number.
order_totalnumericRequired. Order total value.
additional_infoarrayOptional. Extra metadata key/value pairs.
additional_info.*.keystringRequired when additional_info is provided.
additional_info.*.valuestringRequired when additional_info is provided.

Request example

{
  "order_number": "ORDER-1001",
  "design_ids": [456, 457],
  "customer": {
    "first_name": "Jane",
    "last_name": "Doe",
    "address1": "123 Main St",
    "address2": "Suite 4",
    "city": "City",
    "region": "State",
    "postal_code": "12345",
    "country": "US",
    "email": "[email protected]",
    "phone": "555-1234"
  },
  "order_total": 150.00,
  "additional_info": [
    { "key": "SalesPerson", "value": "Alice" }
  ]
}

Success response

{
  "success": true,
  "message": "Order placed successfully",
  "data": {
    "job_id": "JOB-999",
    "design_ids": [456, 457],
    "csp_response": {
      "JobID": "JOB-999",
      "OrderStatus": "Success"
    }
  }
}

Notes

Important: Every API request requires both X-Store-Key and X-Store-Hash headers.
Use GET /api/design/details/{design_id}?sync=true to refresh local design data from CSP.