org-clock-sum gets the time logged for a header and all of its children. Is there a way to get the time logged ONLY for the top level header (but not its children?).
If by top level header you mean the outline level 1:
(org-clock-sum nil nil (lambda () (= (org-outline-level) 1)))
(save-restriction (org-narrow-to-subtree) (let ((level (org-outline-level))) (org-clock-sum nil nil (lambda () (= (org-outline-level) level)))))
See the third argument of the
Headlines for which HEADLINE-FILTER returns nil are excluded from the clock summation.