I'm Lucy, and I'd be happy to answer your questions today. I'm sorry to hear that this happened.
It's a defense to an assault charge that the other person initiated the fight, or that you were acting in defense of someone else. However, you're only allowed to use proportional force to what he was using. If he took a swing at you and you hit him once, that's proportional. I'm a little concerned by your use of the phrase "beat him up," because it sounds like you may have gone beyond what was necessary to defend yourself.
Most people in this position will plead not guilty, request a lawyer, and then try to negotiate a plea bargain. Look at whether they're charging you with an infraction or a misdemeanor, and then decide whether you'd prefer to spend the time in court defending the ticket. If it's an infraction, there's no constitutional right to have a lawyer represent you.
If you have any questions or concerns about my response, please reply WITHOUT RATING. It's important that you are 100% satisfied with my courtesy and professionalism. Otherwise, please rate my service positively so I am paid for the time I spend answering questions. If you are on a mobile device, you may need to scroll to the right. There is no charge for follow-up questions. Thank you.