<@ULVA73B9P> Is it possible to use custom flow ID ...
# ask-marvin
r
@Marvin Is it possible to use custom flow ID ?
m
thought for 341.6 seconds
Short answer: no. In Prefect 3.x, both flow IDs and flow run IDs are system-generated UUIDs and cannot be customized. What you can customize: - Flow name: set via the
@flow
decorator’s
name
parameter - Flow run name: set via the
@flow
decorator’s
flow_run_name
or when creating a run via the API/client - Idempotency: use
idempotency_key
when creating runs to deduplicate requests Examples:
Copy code
from prefect import flow

@flow(name="my-custom-flow-name")
def my_flow():
    return "hello"
Create a flow run programmatically with a custom name and idempotency key:
Copy code
import asyncio
from prefect.client.orchestration import get_client
from prefect.client.schemas.actions import FlowRunCreate

async def trigger():
    async with get_client() as client:
        flow_id = "00000000-0000-0000-0000-000000000000"  # replace with your flow's ID
        fr = await client.create_flow_run(
            FlowRunCreate(
                flow_id=flow_id,
                name="orders-etl-2025-11-05",
                idempotency_key="orders-etl-2025-11-05"
            )
        )
        print(fr.id)

asyncio.run(trigger())
References: - Flow decorator API: prefect.flows API - Create flow run (REST): Create Flow Run REST API - Custom metadata (names, tags, labels): Custom metadata guide If you had something specific in mind by “custom flow ID” (e.g., aligning with an external system’s identifier), let me know your use case—there may be a pattern using names, labels, or artifacts that fits.