Skip to main content

CloudEvents 1.0 Mock Data API

MOCK DATA

Generate coherent mock CloudEvents 1.0 structured JSON envelopes with all required context attributes and action-specific event data.

Generated test data for fixtures and development

Base URL
/api/cloud-events
Capabilities
1 route Seedable
Last updated
July 29, 2026

GET /api/cloud-events

Live requestRuns against the public API
No key required
GET/api/cloud-events?count=10&seed=42

Request parameters

Only generate events for this resource domain. Omit for a mix.

Only generate this lifecycle action. Omit for a mix.

Non-empty RFC 3986 URI-reference, preserved exactly. Use percent-encoding for Unicode; URI user information/credentials are rejected.

Earliest event time, inclusive. With neither bound, defaults to seven UTC days before today; with only to, derives to minus seven days.

Latest event time, inclusive. With neither bound, defaults to the end of today; with only from, derives from plus seven days.

Advanced response options7 options

How many records to generate (1–100).

Deterministic output: the same seed always returns the same records. Omit for random (the used seed is echoed in meta.seed).

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

Return all fields except these (comma-separated).

Response format: json envelope, ndjson (one record per line) or csv.

Pretty-print the JSON response.

Drop the envelope: return the raw array/object without data/meta wrapper.

Response

Example parameters are ready. Send the request to inspect the live response.

Route reference

Code samples Ready-to-copy requests in 4 languages
Choose a code sample language
curl "https://randomapi.dev/api/cloud-events?seed=42&count=10"
const res = await fetch("https://randomapi.dev/api/cloud-events?seed=42&count=10");
const { data, meta } = await res.json();
import requests

data = requests.get("https://randomapi.dev/api/cloud-events?seed=42&count=10").json()["data"]
$json = json_decode(file_get_contents(
  "https://randomapi.dev/api/cloud-events?seed=42&count=10"
), true);
$data = $json["data"];
Parameters Route-specific request inputs 5
resource enum

Only generate events for this resource domain. Omit for a mix.

allowed: user | order | file | deployment
example: resource=order
action enum

Only generate this lifecycle action. Omit for a mix.

allowed: created | updated | deleted | failed
example: action=updated
source string

Non-empty RFC 3986 URI-reference, preserved exactly. Use percent-encoding for Unicode; URI user information/credentials are rejected.

default: /randomapi/demo
allowed: 1 – 256
example: source=/acme/orders
from date

Earliest event time, inclusive. With neither bound, defaults to seven UTC days before today; with only to, derives to minus seven days.

example: from=2026-01-01
to date

Latest event time, inclusive. With neither bound, defaults to the end of today; with only from, derives from plus seven days.

example: to=2026-01-31T23:59:59.999Z
Universal parameters Shared response and formatting options 7
count int

How many records to generate (1–100).

default: 10
allowed: 1 – 100
example: count=3
seed int

Deterministic output: the same seed always returns the same records. Omit for random (the used seed is echoed in meta.seed).

example: seed=42
fields list

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

example: fields=specversion,id
exclude list

Return all fields except these (comma-separated).

example: exclude=data
format enum

Response format: json envelope, ndjson (one record per line) or csv.

default: json
allowed: json | ndjson | csv
example: format=csv
pretty boolean

Pretty-print the JSON response.

default: false
example: pretty=true
unwrap boolean

Drop the envelope: return the raw array/object without data/meta wrapper.

default: false
example: unwrap=true
Response schema Fields returned in each record 8
specversion string

CloudEvents specification version; always the required wire value 1.0.

example: 1.0

id string (UUID v4)

Unique fictional event identifier.

example: a5a12c9e-d4de-4f0a-a498-2f75b78f0562

source string (URI-reference)

Validated RFC 3986 event-source URI-reference, preserved exactly.

example: /acme/orders

type string

dev.randomapi.<resource>.<action>.

example: dev.randomapi.order.updated

subject string

Resource name and fictional id, e.g. order/ord_....

example: order/ord_71d14f42d1804b91

time string (ISO 8601)

Event instant within the resolved from/to window.

example: 2026-01-18T14:27:31.488Z

datacontenttype string

Content type of data; always application/json.

example: application/json

data object

Mock payload coherent with resource and action; failures contain error, deletions only identity/time.

example: {"id":"ord_71d14f42d1804b91","changes":{"status":"shipped"}}

Documented examples

Build-generated requests and complete responses
3
Reproducible mixed CloudEvents
GET /api/cloud-events?seed=42&count=10
{
  "data": [
    {
      "specversion": "1.0",
      "id": "1f1b462a-dd96-4ac0-9949-77f1b8d626ef",
      "source": "/randomapi/demo",
      "type": "dev.randomapi.order.deleted",
      "subject": "order/ord_npkbz95502kswr6y",
      "time": "2026-07-26T18:50:09.517Z",
      "datacontenttype": "application/json",
      "data": {
        "id": "ord_npkbz95502kswr6y",
        "deletedAt": "2026-07-26T18:50:09.517Z"
      }
    },
    {
      "specversion": "1.0",
      "id": "5e920b14-20de-47a8-95dc-4de0fae53a11",
      "source": "/randomapi/demo",
      "type": "dev.randomapi.user.created",
      "subject": "user/usr_uwy89ksfiy8epu1q",
      "time": "2026-07-25T13:49:59.576Z",
      "datacontenttype": "application/json",
      "data": {
        "id": "usr_uwy89ksfiy8epu1q",
        "name": "Maureen Heller",
        "email": "maureen.heller@example.net",
        "status": "active"
      }
    },
    {
      "specversion": "1.0",
      "id": "b745be16-6984-4151-b69e-d7d77d9ded48",
      "source": "/randomapi/demo",
      "type": "dev.randomapi.deployment.created",
      "subject": "deployment/dep_vletuvc3ytvs1yji",
      "time": "2026-07-24T19:12:18.483Z",
      "datacontenttype": "application/json",
      "data": {
        "id": "dep_vletuvc3ytvs1yji",
    …
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}
Updated order events from a custom source
GET /api/cloud-events?resource=order&action=updated&source=%2Facme%2Forders&count=20
{
  "data": [
    {
      "specversion": "1.0",
      "id": "1f1b462a-dd96-4ac0-9949-77f1b8d626ef",
      "source": "/acme/orders",
      "type": "dev.randomapi.order.updated",
      "subject": "order/ord_npkbz95502kswr6y",
      "time": "2026-07-25T19:44:02.739Z",
      "datacontenttype": "application/json",
      "data": {
        "id": "ord_npkbz95502kswr6y",
        "changes": {
          "status": "shipped"
        }
      }
    },
    {
      "specversion": "1.0",
      "id": "5e920b14-20de-47a8-95dc-4de0fae53a11",
      "source": "/acme/orders",
      "type": "dev.randomapi.order.updated",
      "subject": "order/ord_uwy89ksfiy8epu1q",
      "time": "2026-07-22T07:35:34.852Z",
      "datacontenttype": "application/json",
      "data": {
        "id": "ord_uwy89ksfiy8epu1q",
        "changes": {
          "status": "processing"
        }
      }
    },
    {
      "specversion": "1.0",
      "id": "b745be16-6984-4151-b69e-d7d77d9ded48",
      "source": "/acme/orders",
      "type": "dev.randomapi.order.updated",
      "subject": "order/ord_vletuvc3ytvs1yji",
      "time": "2026-07-28T20:32:27.342Z",
      "datacontenttype": "application/json",
    …
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}
Failed deployments in January
GET /api/cloud-events?resource=deployment&action=failed&from=2026-01-01&to=2026-01-31T23%3A59%3A59.999Z&count=25
{
  "data": [
    {
      "specversion": "1.0",
      "id": "1f1b462a-dd96-4ac0-9949-77f1b8d626ef",
      "source": "/randomapi/demo",
      "type": "dev.randomapi.deployment.failed",
      "subject": "deployment/dep_npkbz95502kswr6y",
      "time": "2026-01-15T19:28:10.615Z",
      "datacontenttype": "application/json",
      "data": {
        "id": "dep_npkbz95502kswr6y",
        "operation": "failed",
        "error": {
          "code": "CONFIG_INVALID",
          "message": "The deployment configuration is invalid.",
          "retryable": false
        }
      }
    },
    {
      "specversion": "1.0",
      "id": "5e920b14-20de-47a8-95dc-4de0fae53a11",
      "source": "/randomapi/demo",
      "type": "dev.randomapi.deployment.failed",
      "subject": "deployment/dep_uwy89ksfiy8epu1q",
      "time": "2026-01-02T05:25:22.554Z",
      "datacontenttype": "application/json",
      "data": {
        "id": "dep_uwy89ksfiy8epu1q",
        "operation": "failed",
        "error": {
          "code": "HEALTHCHECK_FAILED",
          "message": "The deployment health check failed.",
          "retryable": true
        }
      }
    },
    {
      "specversion": "1.0",
    …
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}

About this API

Coverage & behavior

Generates mock events in the CloudEvents 1.0.2 JSON structured-content shape. Every record contains the four required context attributes—specversion, id, source and type—plus the optional subject, time and datacontenttype context attributes and a JSON data payload. The wire-level specversion remains 1.0, as required by the 1.0.x specification.

resource and action genuinely determine both type and data: for example dev.randomapi.order.updated carries an order id plus changed fields. Deleted events contain only identity and deletion time rather than pretending to expose live state. Failed events contain a resource-specific error object.

The default source is the safe URI-reference /randomapi/demo. Custom values are preserved after full RFC 3986 URI-reference validation; raw Unicode must be percent-encoded, and authority user information is rejected so credentials are never echoed. With neither time bound, from is seven UTC days before today and to is the end of today. Supplying only one bound derives the other exactly seven days away. These are fictional test envelopes, not messages from a real event source, and no undocumented extension attributes are generated.

Use it for

  • Test event routers and consumers with valid structured CloudEvents envelopes
  • Populate event-stream UIs with coherent created, updated, deleted and failed payloads
  • Build reproducible contract-test fixtures without depending on a broker

Frequently asked questions

Which CloudEvents attributes are included?

The required context attributes are specversion, id, source and type. Each fixture also includes optional subject, time and datacontenttype context attributes plus JSON event data; no extension attributes are silently added.

Why does specversion say 1.0 instead of 1.0.2?

CloudEvents patch releases retain the wire-level value 1.0; this endpoint follows the 1.0.2 specification while emitting the required specversion value.

Are deleted events full resource snapshots?

No. Deleted events return only the resource id and deletedAt, avoiding the misleading claim that deleted state is still available.

Are these events from a real cloud service?

No. Every envelope and payload is generated mock data intended for tests, demos and event-consumer development.

Standards & references