function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ashritha ReddyAshritha Reddy 


how can we make the callouts in batch apex?
Hello Ashritha,

You have to implement the batch class with Database.AllowCallouts Interface as shown below. 

global class SearchAndReplace implements Database.Batchable<sObject>, 

For more info.

Hope it helps you.

Hi Ashritha,

Yes, we can make callouts in batch apex. But we need to be aware of some constraints/limits.

This line is from salesforce doc:
To use a callout in batch Apex, specify Database.AllowsCallouts in the class definition. For example:
global class SearchAndReplace implements Database.Batchable<sObject>,

Here are some doc to give you more info:

There are lot of discussion around this topic already in developer community.

Dont forget to read the limitations.

Hope this helps.

Piyush Kumar 58Piyush Kumar 58
Hello Ashritha,

Yes, batch apex class allow us to make callout. 
You must add Database.AllowsCallouts in your batch class.
You can write callout method in the start section.
public with sharing class BatchCallout implements Database.Batchable<sObject>,Database.AllowsCallouts,Database.Stateful{

   public Database.QueryLocator start(Database.BatchableContext bc) {


  public void execute(Database.BatchableContext BC, list<sObject> scope){

// write here to callout method

  public void finish(Database.BatchableContext BC){