Skip to content

Orders

Access via client.orders.

signtraker.orders.OrdersClient

OrdersClient(api_key: Optional[str] = None, base_url: Optional[str] = None, *, subdomain: Optional[str] = None, timeout_seconds: Optional[float] = None, max_retries: Optional[int] = None, retry_backoff_seconds: Optional[float] = None)

Bases: BaseClient

Client for the /api/orders endpoints.

Source code in signtraker/base_client.py
def __init__(
    self,
    api_key: Optional[str] = None,
    base_url: Optional[str] = None,
    *,
    subdomain: Optional[str] = None,
    timeout_seconds: Optional[float] = None,
    max_retries: Optional[int] = None,
    retry_backoff_seconds: Optional[float] = None,
) -> None:
    """Initialize the base client.

    The base URL is resolved from the first available of: ``base_url``,
    ``subdomain`` (expanded to ``https://{subdomain}.signtraker.com``), the
    ``SIGNTRAKER_BASE_URL`` env var, or the ``SIGNTRAKER_SUBDOMAIN`` env var.

    Args:
        api_key: API key. Falls back to the ``SIGNTRAKER_API_KEY`` env var.
        base_url: Full API base URL (e.g.
            ``"https://acme.signtraker.com"``). Overrides ``subdomain``.
        subdomain: Tenant subdomain used to build the base URL when
            ``base_url`` is not provided.
        timeout_seconds: Per-request timeout. Falls back to env/default.
        max_retries: Retry attempts for transient failures.
        retry_backoff_seconds: Base backoff between retries (exponential).

    Raises:
        AuthenticationError: If no API key can be resolved.
        SignTrakerConfigError: If no base URL or subdomain can be resolved.
    """
    self.api_key = api_key or _getenv_with_alias(ENV_API_KEY, ENV_API_KEY_ALT)
    if not self.api_key:
        raise AuthenticationError(
            "API key is required. Set SIGNTRAKER_API_KEY or pass api_key."
        )
    self.base_url = self._resolve_base_url(base_url, subdomain)
    self.timeout_seconds = (
        float(timeout_seconds)
        if timeout_seconds is not None
        else _parse_env_float(ENV_TIMEOUT_SECONDS, DEFAULT_TIMEOUT_SECONDS)
    )
    self.max_retries = (
        int(max_retries)
        if max_retries is not None
        else _parse_env_int(ENV_MAX_RETRIES, DEFAULT_MAX_RETRIES)
    )
    self.retry_backoff_seconds = (
        float(retry_backoff_seconds)
        if retry_backoff_seconds is not None
        else _parse_env_float(
            ENV_RETRY_BACKOFF_SECONDS, DEFAULT_RETRY_BACKOFF_SECONDS
        )
    )
    self.session = requests.Session()
    self.session.headers.update(
        {
            "Authorization": f"ST-API {self.api_key}",
            "Content-Type": "application/json",
            "Accept": "application/json",
        }
    )

list_orders

list_orders(*, filter: Optional[str] = None, top: Optional[int] = None, skip: Optional[int] = None, orderby: Optional[ODataValue] = None, select: Optional[ODataValue] = None) -> List[Dict[str, Any]]

List signage orders.

Parameters:

Name Type Description Default
filter Optional[str]

OData $filter expression.

None
top Optional[int]

OData $top (maximum number of records to return).

None
skip Optional[int]

OData $skip (number of records to skip).

None
orderby Optional[ODataValue]

OData $orderby value or sequence of fields.

None
select Optional[ODataValue]

OData $select value or sequence of fields.

None

Returns:

Type Description
List[Dict[str, Any]]

The list of signage order records.

Raises:

Type Description
AuthenticationError

If the API key is invalid.

SignTrakerError

For other API errors.

Source code in signtraker/orders.py
def list_orders(
    self,
    *,
    filter: Optional[str] = None,
    top: Optional[int] = None,
    skip: Optional[int] = None,
    orderby: Optional[ODataValue] = None,
    select: Optional[ODataValue] = None,
) -> List[Dict[str, Any]]:
    """List signage orders.

    Args:
        filter: OData ``$filter`` expression.
        top: OData ``$top`` (maximum number of records to return).
        skip: OData ``$skip`` (number of records to skip).
        orderby: OData ``$orderby`` value or sequence of fields.
        select: OData ``$select`` value or sequence of fields.

    Returns:
        The list of signage order records.

    Raises:
        AuthenticationError: If the API key is invalid.
        SignTrakerError: For other API errors.
    """
    params = build_odata_params(
        filter=filter, top=top, skip=skip, orderby=orderby, select=select
    )
    return cast(List[Dict[str, Any]], self.get("api/orders", params))

get_order

get_order(order_id: int) -> Dict[str, Any]

Get a single signage order by ID.

Parameters:

Name Type Description Default
order_id int

Unique identifier of the signage order.

required

Returns:

Type Description
Dict[str, Any]

The signage order record.

Raises:

Type Description
NotFoundError

If the order does not exist.

AuthenticationError

If the API key is invalid.

SignTrakerError

For other API errors.

Source code in signtraker/orders.py
def get_order(self, order_id: int) -> Dict[str, Any]:
    """Get a single signage order by ID.

    Args:
        order_id: Unique identifier of the signage order.

    Returns:
        The signage order record.

    Raises:
        NotFoundError: If the order does not exist.
        AuthenticationError: If the API key is invalid.
        SignTrakerError: For other API errors.
    """
    return cast(Dict[str, Any], self.get(f"api/orders/{order_id}"))

create_order

create_order(order: Dict[str, Any]) -> Dict[str, Any]

Create a signage order.

Note

This functionality applies to National Accounts only; individual Licensee portals do not have Order Presets available.

Parameters:

Name Type Description Default
order Dict[str, Any]

The order payload. Required fields include AgentId and PresetId.

required

Returns:

Type Description
Dict[str, Any]

The create result (Status, Message, RequestId,

Dict[str, Any]

OrderId).

Raises:

Type Description
ValidationError

If the payload is invalid.

AuthenticationError

If the API key is invalid.

SignTrakerError

For other API errors.

Source code in signtraker/orders.py
def create_order(self, order: Dict[str, Any]) -> Dict[str, Any]:
    """Create a signage order.

    Note:
        This functionality applies to National Accounts only; individual
        Licensee portals do not have Order Presets available.

    Args:
        order: The order payload. Required fields include ``AgentId`` and
            ``PresetId``.

    Returns:
        The create result (``Status``, ``Message``, ``RequestId``,
        ``OrderId``).

    Raises:
        ValidationError: If the payload is invalid.
        AuthenticationError: If the API key is invalid.
        SignTrakerError: For other API errors.
    """
    return cast(Dict[str, Any], self.post("api/orders", json_data=order))

request_removal

request_removal(order_id: int, removal_request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]

Request removal of an installed signage order.

Parameters:

Name Type Description Default
order_id int

Unique identifier of the signage order.

required
removal_request Optional[Dict[str, Any]]

Optional payload with DueDate and Notes.

None

Returns:

Type Description
Dict[str, Any]

The result payload (typically {"DueDate": ...}).

Raises:

Type Description
NotFoundError

If the order does not exist.

ValidationError

If the payload is invalid.

AuthenticationError

If the API key is invalid.

SignTrakerError

For other API errors.

Source code in signtraker/orders.py
def request_removal(
    self, order_id: int, removal_request: Optional[Dict[str, Any]] = None
) -> Dict[str, Any]:
    """Request removal of an installed signage order.

    Args:
        order_id: Unique identifier of the signage order.
        removal_request: Optional payload with ``DueDate`` and ``Notes``.

    Returns:
        The result payload (typically ``{"DueDate": ...}``).

    Raises:
        NotFoundError: If the order does not exist.
        ValidationError: If the payload is invalid.
        AuthenticationError: If the API key is invalid.
        SignTrakerError: For other API errors.
    """
    return cast(
        Dict[str, Any],
        self.post(
            f"api/orders/{order_id}/requestremoval",
            json_data=removal_request or {},
        ),
    )