can we load test api's using Gatling tool

Hi,

Can we load test api’s instead of http requests using Gatling tool?
Can we write some code in scenarios and load test it?

If yes can you please put some sample code?

By API, you mean Java code?

Yes, Can we write scala code in scenario and load test that scenario?

We’ll probably add some facilities for this in Gatling 2. Until then, you can write your own Protocol: https://github.com/excilys/gatling/wiki/Protocol-support.
Did you also have a look at benchmark tools, such as JMH?