Short answer: generally yes, urban planter boxes can be safe for vegetables you plan to eat, but they are not automatically safe. Safety depends on what the box is made of, where it sits, what soil you fill it with, and how you manage water and dust.
Start with the container. Avoid old pressure-treated wood that may contain arsenic, old railroad ties, tires, and wood with lead-based paint. These can leach or flake contaminants into the soil. Good choices include untreated cedar, redwood, or pine, food-grade HDPE plastic, and well-made galvanized metal with an inert food-safe liner if you are concerned about zinc. If you use painted or recycled materials, confirm they are lead-free and food-safe. A liner can separate soil from the container, but it does not make a contaminated site safe.
Soil is the biggest factor. Do not fill boxes with soil from unknown ground, especially near old buildings, busy roads, industrial sites, or areas with peeling paint. Use a clean growing mix, compost from a reliable source, and aged manure. If boxes sit on or near ground with possible contamination, keep them on a hard surface or use a barrier that still allows drainage, and avoid direct contact with suspect soil. Test soil for lead, arsenic, cadmium, and pH if you are unsure; local extension services can help.
Location matters. Place boxes away from heavy traffic, construction dust, old painted buildings, and runoff from roofs or roads. Mulch the soil surface to reduce dust and splashing. Use a clean water source and avoid watering with rain runoff from contaminated roofs. Keep the garden well drained, and do not use treated wood scraps or ashes from unknown sources as amendments.
Plant choice and harvest habits also help. Leafy greens and root crops can accumulate more soil contaminants than fruiting crops such as tomatoes and peppers, so clean soil is especially important for them. Wash all produce thoroughly, remove outer leaves, peel root vegetables, and cook when appropriate. Regular maintenance, fresh compost, and crop rotation keep plants healthy.
Bottom line: urban planter boxes can be a safe way to grow food if you choose food-safe materials, use clean tested soil, site them wisely, and wash your harvest. If you have reason to suspect contamination, test before planting and ask your local extension office for advice.