¡Hola!
didn't need to (infinitive) & needn't have (past participle) are used to express the lack of necessity in the past, however
didn't need implies that the speaker didn't do something because he/she new that it was not necessary
needn't have means the speaker did something and then he/she knew that it had not been necessary
for example:
I didn't need to have an interview because I had worked there before
I needn't have cooked dinner. Just as it was ready, Chris and June phoned to say that they couldn't come to eat
(examples are taken from Advanced Grammar in Use by Martin Hewings)
How can I express it in Spanish?
Regards,
Alexander