The following is the criteria for a written work to be canonized by the
church:
1. Apostolic Authority: the book must be written or co-authored by the Holy Spirit. This can means they must be written by one of the 12 disciples or under the authority or guidance of one of the disciples. (Because of this Paul counts as a disciple because he was appointed by the resurrected Jesus, and Mark although he is not a disciple he is considered Peter's secretary and side-kick.).
2. Must be close to source.
3. Antiquity: must be old enough to be apostolic.
4. Orthodoxy: Must teach the right thing. Does the writing match up to the apostle? To test it must hold true to the teachings of the church the apostle started.
5. Catholicity: Universal. Must be universally recognized by all churches.
For the criteria for human canonization see: Canonization Process