subbydocs
Visit Subby Start building

Sandbox test helpers

Sandbox-only tools. Return 404 in live.

OpenAPI

https://sandbox-api.mysubbyapp.com/v1

POST/test/clocks

Create a test clock

Sandbox only

Request example

curl --request POST \
  --url 'https://sandbox-api.mysubbyapp.com/v1/test/clocks' \
  --header 'Authorization: Bearer sk_test_YOUR_SECRET_KEY'

Add a JSON body matching the request schema below and a Content-Type: application/json header.

Request body schema
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "required": [
          "frozen_time"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "frozen_time": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    }
  }
}

Responses

201 The test clock.
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "success": {
          "const": true
        },
        "data": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "example": "clock_1Qz"
            },
            "object": {
              "const": "test_clock"
            },
            "name": {
              "type": [
                "string",
                "null"
              ]
            },
            "frozen_time": {
              "type": "string",
              "format": "date-time"
            },
            "status": {
              "type": "string",
              "enum": [
                "ready",
                "advancing",
                "internal_failure"
              ]
            },
            "customer_count": {
              "type": "integer"
            },
            "deletes_at": {
              "type": "string",
              "format": "date-time"
            },
            "created_at": {
              "type": "string",
              "format": "date-time"
            }
          }
        }
      }
    }
  }
}
404 Object or route not found in this environment.
{
  "application/json": {
    "schema": {
      "type": "object",
      "required": [
        "success",
        "error"
      ],
      "properties": {
        "success": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "type",
            "code",
            "message",
            "request_id"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "authentication_error",
                "permission_error",
                "invalid_request_error",
                "state_error",
                "idempotency_error",
                "rate_limit_error",
                "api_error"
              ]
            },
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "param": {
              "type": [
                "string",
                "null"
              ]
            },
            "request_id": {
              "type": "string"
            },
            "doc_url": {
              "type": "string",
              "format": "uri"
            }
          }
        }
      }
    }
  }
}
GET/test/clocks

List test clocks

Sandbox only

Request example

curl --request GET \
  --url 'https://sandbox-api.mysubbyapp.com/v1/test/clocks' \
  --header 'Authorization: Bearer sk_test_YOUR_SECRET_KEY'

Responses

200 Test clocks.
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "success": {
          "const": true
        },
        "data": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "example": "clock_1Qz"
              },
              "object": {
                "const": "test_clock"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "frozen_time": {
                "type": "string",
                "format": "date-time"
              },
              "status": {
                "type": "string",
                "enum": [
                  "ready",
                  "advancing",
                  "internal_failure"
                ]
              },
              "customer_count": {
                "type": "integer"
              },
              "deletes_at": {
                "type": "string",
                "format": "date-time"
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        },
        "meta": {
          "type": "object",
          "required": [
            "has_more",
            "limit"
          ],
          "properties": {
            "has_more": {
              "type": "boolean"
            },
            "next_cursor": {
              "type": [
                "string",
                "null"
              ]
            },
            "limit": {
              "type": "integer"
            }
          }
        }
      }
    }
  }
}
GET/test/clocks/{id}

Retrieve a test clock

Sandbox only

Request example

curl --request GET \
  --url 'https://sandbox-api.mysubbyapp.com/v1/test/clocks/{id}' \
  --header 'Authorization: Bearer sk_test_YOUR_SECRET_KEY'

Parameters

idpath · string · required

Responses

200 The test clock.
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "success": {
          "const": true
        },
        "data": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "example": "clock_1Qz"
            },
            "object": {
              "const": "test_clock"
            },
            "name": {
              "type": [
                "string",
                "null"
              ]
            },
            "frozen_time": {
              "type": "string",
              "format": "date-time"
            },
            "status": {
              "type": "string",
              "enum": [
                "ready",
                "advancing",
                "internal_failure"
              ]
            },
            "customer_count": {
              "type": "integer"
            },
            "deletes_at": {
              "type": "string",
              "format": "date-time"
            },
            "created_at": {
              "type": "string",
              "format": "date-time"
            }
          }
        }
      }
    }
  }
}
DELETE/test/clocks/{id}

Delete a test clock and its customers

Sandbox only

Request example

curl --request DELETE \
  --url 'https://sandbox-api.mysubbyapp.com/v1/test/clocks/{id}' \
  --header 'Authorization: Bearer sk_test_YOUR_SECRET_KEY'

Parameters

idpath · string · required

Responses

200 Deletion confirmation.
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "success": {
          "const": true
        },
        "data": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "deleted": {
              "const": true
            }
          }
        }
      }
    }
  }
}
POST/test/clocks/{id}/advance

Advance a test clock

Sandbox only

Request example

curl --request POST \
  --url 'https://sandbox-api.mysubbyapp.com/v1/test/clocks/{id}/advance' \
  --header 'Authorization: Bearer sk_test_YOUR_SECRET_KEY'

Add a JSON body matching the request schema below and a Content-Type: application/json header.

Parameters

idpath · string · required

Request body schema
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "required": [
          "frozen_time"
        ],
        "properties": {
          "frozen_time": {
            "type": "string",
            "format": "date-time",
            "description": "Must be later than the current frozen_time and at most 1 year ahead."
          }
        }
      }
    }
  }
}

Responses

202 Advancing started. Status is `advancing` until `test_clock.ready`.
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "success": {
          "const": true
        },
        "data": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "example": "clock_1Qz"
            },
            "object": {
              "const": "test_clock"
            },
            "name": {
              "type": [
                "string",
                "null"
              ]
            },
            "frozen_time": {
              "type": "string",
              "format": "date-time"
            },
            "status": {
              "type": "string",
              "enum": [
                "ready",
                "advancing",
                "internal_failure"
              ]
            },
            "customer_count": {
              "type": "integer"
            },
            "deletes_at": {
              "type": "string",
              "format": "date-time"
            },
            "created_at": {
              "type": "string",
              "format": "date-time"
            }
          }
        }
      }
    }
  }
}
422 Valid request that conflicts with the object's state.
{
  "application/json": {
    "schema": {
      "type": "object",
      "required": [
        "success",
        "error"
      ],
      "properties": {
        "success": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "type",
            "code",
            "message",
            "request_id"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "authentication_error",
                "permission_error",
                "invalid_request_error",
                "state_error",
                "idempotency_error",
                "rate_limit_error",
                "api_error"
              ]
            },
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "param": {
              "type": [
                "string",
                "null"
              ]
            },
            "request_id": {
              "type": "string"
            },
            "doc_url": {
              "type": "string",
              "format": "uri"
            }
          }
        }
      }
    }
  }
}
POST/test/events/trigger

Trigger a webhook event

Sandbox only

Request example

curl --request POST \
  --url 'https://sandbox-api.mysubbyapp.com/v1/test/events/trigger' \
  --header 'Authorization: Bearer sk_test_YOUR_SECRET_KEY'

Add a JSON body matching the request schema below and a Content-Type: application/json header.

Request body schema
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "example": "subscription.escalated"
          },
          "object": {
            "type": "string",
            "description": "Existing sandbox object ID to use instead of generated data."
          },
          "overrides": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    }
  }
}

Responses

201 The created event, queued for delivery.
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "success": {
          "const": true
        },
        "data": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "example": "evt_3Lk9qPz1Tx"
            },
            "object": {
              "const": "event"
            },
            "type": {
              "type": "string"
            },
            "api_version": {
              "type": "string"
            },
            "livemode": {
              "type": "boolean"
            },
            "created_at": {
              "type": "string",
              "format": "date-time"
            },
            "data": {
              "type": "object",
              "properties": {
                "object": {
                  "type": "object",
                  "additionalProperties": true
                },
                "previous_attributes": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    }
  }
}
400 Invalid request.
{
  "application/json": {
    "schema": {
      "type": "object",
      "required": [
        "success",
        "error"
      ],
      "properties": {
        "success": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "type",
            "code",
            "message",
            "request_id"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "authentication_error",
                "permission_error",
                "invalid_request_error",
                "state_error",
                "idempotency_error",
                "rate_limit_error",
                "api_error"
              ]
            },
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "param": {
              "type": [
                "string",
                "null"
              ]
            },
            "request_id": {
              "type": "string"
            },
            "doc_url": {
              "type": "string",
              "format": "uri"
            }
          }
        }
      }
    }
  }
}
GET/test/nudge-outbox

List simulated nudges with rendered messages

Sandbox only

Request example

curl --request GET \
  --url 'https://sandbox-api.mysubbyapp.com/v1/test/nudge-outbox' \
  --header 'Authorization: Bearer sk_test_YOUR_SECRET_KEY'

Parameters

limitquery · integer

starting_afterquery · string

customerquery · string

Responses

200 Outbox entries.
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "success": {
          "const": true
        },
        "data": {
          "type": "array",
          "items": {
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "example": "ndg_7Yt2Qa"
                  },
                  "object": {
                    "const": "nudge"
                  },
                  "customer": {
                    "type": "string"
                  },
                  "subscription": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "channel": {
                    "type": "string",
                    "enum": [
                      "whatsapp",
                      "sms",
                      "email"
                    ]
                  },
                  "template": {
                    "type": "string"
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "automatic",
                      "api",
                      "dashboard"
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "queued",
                      "sent",
                      "delivered",
                      "failed"
                    ]
                  },
                  "failure_reason": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "counts_toward_allowance": {
                    "type": "boolean"
                  },
                  "billed_as_overage": {
                    "type": "boolean"
                  },
                  "sent_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "delivered_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "livemode": {
                    "type": "boolean"
                  },
                  "created_at": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "to": {
                    "type": "string"
                  },
                  "rendered_message": {
                    "type": "string"
                  },
                  "payment_link": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              }
            ]
          }
        },
        "meta": {
          "type": "object",
          "required": [
            "has_more",
            "limit"
          ],
          "properties": {
            "has_more": {
              "type": "boolean"
            },
            "next_cursor": {
              "type": [
                "string",
                "null"
              ]
            },
            "limit": {
              "type": "integer"
            }
          }
        }
      }
    }
  }
}
POST/test/reset

Delete all sandbox data

Keeps API keys and webhook endpoints.

Sandbox only

Request example

curl --request POST \
  --url 'https://sandbox-api.mysubbyapp.com/v1/test/reset' \
  --header 'Authorization: Bearer sk_test_YOUR_SECRET_KEY'

Add a JSON body matching the request schema below and a Content-Type: application/json header.

Request body schema
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "required": [
          "confirm"
        ],
        "properties": {
          "confirm": {
            "const": "RESET"
          }
        }
      }
    }
  }
}

Responses

202 Reset started.
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "success": {
          "const": true
        },
        "data": {
          "type": "object",
          "properties": {
            "status": {
              "const": "resetting"
            }
          }
        }
      }
    }
  }
}