Management APISources (Legacy)

Sources

Sources represent the websites or applications that send events to Datafly Signal. Each source has a unique pipeline key used by Datafly.js (or the server-side API) to authenticate event submissions.

Source Object

{
  "id": "src_abc123",
  "name": "Marketing Website",
  "pipeline_key": "dk_live_m4rk3t1ng",
  "domain": "www.example.com",
  "config": {
    "vendors": ["ga4", "meta_capi"],
    "consent": {
      "enabled": true,
      "default_categories": ["functional"],
      "provider": "onetrust"
    },
    "cross_domain": {
      "enabled": false,
      "domains": []
    },
    "collector": {
      "filename": "d.js",
      "global_var": "_df"
    }
  },
  "created_at": "2026-01-10T08:00:00Z",
  "updated_at": "2026-02-20T14:30:00Z"
}
FieldTypeDescription
idstringUnique source identifier
namestringDisplay name
pipeline_keystringPipeline key for event authentication (prefix dk_live_ or dk_test_)
domainstringPrimary domain for CORS and cookie configuration
config.vendorsstring[]Vendor modules included in the JS collector build
config.consentobjectConsent management settings
config.cross_domainobjectCross-domain identity linking settings
config.collectorobjectJS collector build settings (filename, global variable)
created_atstringISO 8601 creation timestamp
updated_atstringISO 8601 last-updated timestamp

List Sources

GET /v1/admin/sources

Returns a paginated list of all sources for the current organisation.

Query parameters:

ParameterTypeDefaultDescription
cursorstringPagination cursor
limitinteger50Items per page (max 100)

Request:

curl -X GET "http://localhost:8084/v1/admin/sources?limit=10" \
  -H "Authorization: Bearer {access_token}"

Response:

{
  "data": [
    {
      "id": "src_abc123",
      "name": "Marketing Website",
      "pipeline_key": "dk_live_m4rk3t1ng",
      "domain": "www.example.com",
      "created_at": "2026-01-10T08:00:00Z",
      "updated_at": "2026-02-20T14:30:00Z"
    }
  ],
  "next_cursor": "eyJpZCI6MTB9",
  "has_more": false
}

Required role: viewer or above.

Create Source

POST /v1/admin/sources

Create a new event source. A pipeline key is automatically generated.

Request:

{
  "name": "E-commerce Store",
  "domain": "shop.example.com",
  "config": {
    "vendors": ["ga4", "meta_capi", "google_ads"],
    "consent": {
      "enabled": true,
      "default_categories": ["functional"],
      "provider": "cookiebot"
    },
    "cross_domain": {
      "enabled": true,
      "domains": ["shop.example.com", "checkout.example.com"]
    },
    "collector": {
      "filename": "d.js",
      "global_var": "_df"
    }
  }
}

Response (201 Created):

{
  "id": "src_def456",
  "name": "E-commerce Store",
  "pipeline_key": "dk_live_sh0p",
  "domain": "shop.example.com",
  "config": {
    "vendors": ["ga4", "meta_capi", "google_ads"],
    "consent": {
      "enabled": true,
      "default_categories": ["functional"],
      "provider": "cookiebot"
    },
    "cross_domain": {
      "enabled": true,
      "domains": ["shop.example.com", "checkout.example.com"]
    },
    "collector": {
      "filename": "d.js",
      "global_var": "_df"
    }
  },
  "created_at": "2026-02-25T10:00:00Z",
  "updated_at": "2026-02-25T10:00:00Z"
}

Required role: editor or above.

Get Source

GET /v1/admin/sources/{id}

Retrieve a single source by ID.

Request:

curl -X GET http://localhost:8084/v1/admin/sources/src_abc123 \
  -H "Authorization: Bearer {access_token}"

Response: Full source object as shown above.

Required role: viewer or above.

Update Source

PUT /v1/admin/sources/{id}

Update an existing source. All fields in the request body replace the current values.

Request:

{
  "name": "Marketing Website (Production)",
  "domain": "www.example.com",
  "config": {
    "vendors": ["ga4", "meta_capi", "tiktok"],
    "consent": {
      "enabled": true,
      "default_categories": ["functional"],
      "provider": "onetrust"
    },
    "cross_domain": {
      "enabled": false,
      "domains": []
    },
    "collector": {
      "filename": "d.js",
      "global_var": "_df"
    }
  }
}

Response: Updated source object.

Required role: editor or above.

⚠️

Updating the vendors list in the source config changes which vendor modules are included in the next JS collector build. You must trigger a new build after updating vendors for the change to take effect in the served script.

Delete Source

DELETE /v1/admin/sources/{id}

Delete a source and revoke its pipeline key. Events sent with this pipeline key will be rejected after deletion.

Request:

curl -X DELETE http://localhost:8084/v1/admin/sources/src_abc123 \
  -H "Authorization: Bearer {access_token}"

Response: 204 No Content

Required role: admin or above.

⚠️

Deleting a source is irreversible. All integrations and transformations associated with the source will also be deleted. In-flight events already in Kafka will still be processed.

Build Collector

POST /v1/admin/sources/{id}/collector/build

Trigger a custom Datafly.js build for this source. The build includes only the vendor modules specified in the source configuration.

Request:

curl -X POST http://localhost:8084/v1/admin/sources/src_abc123/collector/build \
  -H "Authorization: Bearer {access_token}"

Response:

{
  "status": "building",
  "build_id": "bld_789xyz",
  "started_at": "2026-02-25T10:05:00Z"
}

The build runs asynchronously. Poll the source object or use the WebSocket debug stream to monitor build status.

Required role: editor or above.

Download Collector

GET /v1/admin/sources/{id}/collector/download

Download the latest built Datafly.js file for this source.

Request:

curl -X GET http://localhost:8084/v1/admin/sources/src_abc123/collector/download \
  -H "Authorization: Bearer {access_token}" \
  -o d.js

Response: JavaScript file with Content-Type: application/javascript and Content-Disposition: attachment headers.

Required role: editor or above.

If no custom build has been triggered, this endpoint returns the default Datafly.js build with all vendor modules included.