This article proposes a recommendation model based on self-attention mechanism and DeepFM service, the model is SelfA-DeepFM. The method firstly constructs the service network with DTc-LDA model to mine the potential relationship between Mashup and API, which not only fully considers the text attributes but also combines the network structure information to effectively mitigate the sparsity of the service data. Secondly, service clustering to obtain numerical feature similarities. Finally, the self-attention mechanism is used to capture the different importance of feature interactions, and the DeepFM model is used to mine the complex interaction information between multidimensional features to predict and rank the quality score of API services to recommend suitable APIs. To verify the performance of the model, the authors use the real data crawled from the ProgrammableWeb platform to conduct multiple groups of experiments. The experimental results show that the model significantly improves the accuracy of service recommendation.