when was it accepted as the national flag?
1848
Introduction
The flag was first adopted as the national flag of Germany in 1848 by the German Confederation and then, in the modern nation state, in the Weimar Republic (1919-1933).

what does the red on the german flag represent Red and white were also colours of the Hanseatic League (13th–17th century). Hanseatic trading ships were identifiable by their red-white pennants, and most Hanseatic cities adopted red and white as their city colours (see Hanseatic flags)
1848 23 May 1949 1848
Flag of Germany Flag of Germany Flag of Germany
Introduction Divided Germany (1949–89) Introduction
 The flag was first adopted as the national flag of Germany in 1848 by the German Confederation and then, in the modern nation state, in the Weimar Republic (1919-1933). With the enactment of the (West) German constitution on 23 May 1949, the black-red-gold tricolour was readopted as the flag for the Federal Republic of Germany. The flag was first adopted as the national flag of Germany in 1848 by the German Confederation and then, in the modern nation state, in the Weimar Republic (1919-1933).
wiki:13432785
Flag of Germany [SEP] Introduction
The colours black-white-red appeared for the first time in 1867, in the constitution of the North German Confederation. This nation state for Prussia and other north and central German states was expanded to the south German states in 1870–71, under the name German Empire. It kept these colours until the revolution of 1918–19. Thereafter, black-white-red became a symbol of the political right. The national socialists (Nazi Party) in 1933 re-established these colours along with the party's own swastika flag. After World War II, black-white-red was still used by some conservative groups or by groups of the far right – as it is not forbidden, unlike proper national socialist symbols.