Add middleware and api attribution