> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Push records by task ID

> Pushes records through the pipeline, directly to an index.

**Required ACL:** `addObject`, `deleteIndex`, `editSettings`

You can make the call synchronous by providing the `watch` parameter, for asynchronous calls, you can use the observability endpoints or the debugger dashboard to see the status of your task.
If you want to transform your data before indexing, this is the recommended way of ingesting your records.
This method is similar to `push`, but requires a `taskID` instead of a `indexName`, which is useful when many `destinations` target the same `indexName`.

## Usage

<CodeGroup>
  ```cs C# theme={"system"}
  // Initialize the client
  var client = new IngestionClient(
    new IngestionConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
  );

  // Call the API
  var response = await client.PushTaskAsync(
    "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
    new PushTaskPayload
    {
      Action = Enum.Parse<Action>("AddObject"),
      Records = new List<PushTaskRecords>
      {
        new PushTaskRecords
        {
          ObjectID = "o",
          AdditionalProperties = new Dictionary<string, object>
          {
            { "key", "bar" },
            { "foo", "1" },
          },
        },
        new PushTaskRecords
        {
          ObjectID = "k",
          AdditionalProperties = new Dictionary<string, object>
          {
            { "key", "baz" },
            { "foo", "2" },
          },
        },
      },
    }
  );

  // print the response
  Console.WriteLine(response);
  ```

  ```dart Dart theme={"system"}
  // Initialize the client
  final client = IngestionClient(
      appId: 'ALGOLIA_APPLICATION_ID',
      apiKey: 'ALGOLIA_API_KEY',
      region: 'ALGOLIA_APPLICATION_REGION');

  // Call the API
  final response = await client.pushTask(
    taskID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
    pushTaskPayload: PushTaskPayload(
      action: Action.fromJson("addObject"),
      records: [
        PushTaskRecords(
          objectID: "o",
          additionalProperties: {
            'key': "bar",
            'foo': "1",
          },
        ),
        PushTaskRecords(
          objectID: "k",
          additionalProperties: {
            'key': "baz",
            'foo': "2",
          },
        ),
      ],
    ),
  );

  // print the response
  print(response);
  ```

  ```go Go theme={"system"}
  // Initialize the client with your application region, eg. ingestion.ALGOLIA_APPLICATION_REGION
  client, err := ingestion.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", ingestion.US)
  if err != nil {
    // The client can fail to initialize if you pass an invalid parameter.
    panic(err)
  }

  // Call the API
  response, err := client.PushTask(client.NewApiPushTaskRequest(
    "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
    ingestion.NewEmptyPushTaskPayload().SetAction(ingestion.Action("addObject")).SetRecords(
      []ingestion.PushTaskRecords{
        *ingestion.NewEmptyPushTaskRecords().SetAdditionalProperty("key", "bar").SetAdditionalProperty("foo", "1").SetObjectID("o"),
        *ingestion.NewEmptyPushTaskRecords().SetAdditionalProperty("key", "baz").SetAdditionalProperty("foo", "2").SetObjectID("k"),
      }),
  ))
  if err != nil {
    // handle the eventual error
    panic(err)
  }


  // print the response
  print(response)
  ```

  ```java Java theme={"system"}
  // Initialize the client
  IngestionClient client = new IngestionClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION");

  // Call the API
  WatchResponse response = client.pushTask(
    "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
    new PushTaskPayload()
      .setAction(Action.ADD_OBJECT)
      .setRecords(
        Arrays.asList(
          new PushTaskRecords().setAdditionalProperty("key", "bar").setAdditionalProperty("foo", "1").setObjectID("o"),
          new PushTaskRecords().setAdditionalProperty("key", "baz").setAdditionalProperty("foo", "2").setObjectID("k")
        )
      )
  );

  // print the response
  System.out.println(response);
  ```

  ```js JavaScript theme={"system"}
  // Initialize the client
  // Replace 'us' with your Algolia Application Region
  const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY').initIngestion({ region: 'us' });

  // Call the API
  const response = await client.pushTask({
    taskID: '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
    pushTaskPayload: {
      action: 'addObject',
      records: [
        { key: 'bar', foo: '1', objectID: 'o' },
        { key: 'baz', foo: '2', objectID: 'k' },
      ],
    },
  });


  // print the response
  console.log(response);
  ```

  ```kotlin Kotlin theme={"system"}
  // Initialize the client
  val client =
    IngestionClient(
      appId = "ALGOLIA_APPLICATION_ID",
      apiKey = "ALGOLIA_API_KEY",
      region = "ALGOLIA_APPLICATION_REGION",
    )

  // Call the API
  var response =
    client.pushTask(
      taskID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
      pushTaskPayload =
        PushTaskPayload(
          action = Action.entries.first { it.value == "addObject" },
          records =
            listOf(
              PushTaskRecords(
                objectID = "o",
                additionalProperties =
                  mapOf("key" to JsonPrimitive("bar"), "foo" to JsonPrimitive("1")),
              ),
              PushTaskRecords(
                objectID = "k",
                additionalProperties =
                  mapOf("key" to JsonPrimitive("baz"), "foo" to JsonPrimitive("2")),
              ),
            ),
        ),
    )


  // print the response
  println(response)
  ```

  ```php PHP theme={"system"}
  // Initialize the client
  $client = IngestionClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY', 'ALGOLIA_APPLICATION_REGION');

  // Call the API
  $response = $client->pushTask(
      '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
      ['action' => 'addObject',
          'records' => [
              ['key' => 'bar',
                  'foo' => '1',
                  'objectID' => 'o',
              ],

              ['key' => 'baz',
                  'foo' => '2',
                  'objectID' => 'k',
              ],
          ],
      ],
  );


  // print the response
  var_dump($response);
  ```

  ```python Python theme={"system"}
  # Initialize the client
  # In an asynchronous context, you can use IngestionClient instead, which exposes the exact same methods.
  client = IngestionClientSync(
      "ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION"
  )

  # Call the API
  response = client.push_task(
      task_id="6c02aeb1-775e-418e-870b-1faccd4b2c0f",
      push_task_payload={
          "action": "addObject",
          "records": [
              {
                  "key": "bar",
                  "foo": "1",
                  "objectID": "o",
              },
              {
                  "key": "baz",
                  "foo": "2",
                  "objectID": "k",
              },
          ],
      },
  )


  # print the response
  print(response)
  ```

  ```ruby Ruby theme={"system"}
  # Initialize the client
  client = Algolia::IngestionClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")

  # Call the API
  response = client.push_task(
    "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
    Algolia::Ingestion::PushTaskPayload.new(
      action: "addObject",
      records: [
        Algolia::Ingestion::PushTaskRecords.new(key: "bar", foo: "1", algolia_object_id: "o"),
        Algolia::Ingestion::PushTaskRecords.new(key: "baz", foo: "2", algolia_object_id: "k")
      ]
    )
  )


  # print the response
  puts(response)
  ```

  ```scala Scala theme={"system"}
  // Initialize the client
  val client = IngestionClient(
    appId = "ALGOLIA_APPLICATION_ID",
    apiKey = "ALGOLIA_API_KEY",
    region = "ALGOLIA_APPLICATION_REGION"
  )

  // Call the API
  val response = Await.result(
    client.pushTask(
      taskID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
      pushTaskPayload = PushTaskPayload(
        action = Action.withName("addObject"),
        records = Seq(
          PushTaskRecords(
            objectID = "o",
            additionalProperties = Some(List(JField("key", JString("bar")), JField("foo", JString("1"))))
          ),
          PushTaskRecords(
            objectID = "k",
            additionalProperties = Some(List(JField("key", JString("baz")), JField("foo", JString("2"))))
          )
        )
      )
    ),
    Duration(100, "sec")
  )

  // print the response
  println(response)
  ```

  ```swift Swift theme={"system"}
  // Initialize the client
  let client = try IngestionClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY", region: .us)

  // Call the API
  let response = try await client.pushTask(
      taskID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
      pushTaskPayload: PushTaskPayload(
          action: IngestionAction.addObject,
          records: [
              PushTaskRecords(from: [
                  "objectID": AnyCodable("o"),
                  "key": AnyCodable("bar"),
                  "foo": AnyCodable("1"),
              ]),
              PushTaskRecords(from: [
                  "objectID": AnyCodable("k"),
                  "key": AnyCodable("baz"),
                  "foo": AnyCodable("2"),
              ]),
          ]
      )
  )

  // print the response
  print(response)
  ```
</CodeGroup>

<Card icon="folder-code" horizontal="true" title="See the full API reference" arrow="true" href="/doc/rest-api/ingestion/push-task">
  For more details about input parameters
  and response fields.
</Card>

**See also:** [Pre-indexing data transformation](https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/how-to/transform-your-data)
