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

# अभियान अपडेट करें

> Google Ads अभियान शुरू करें या रोकें, उसका नाम बदलें, या उसका दैनिक बजट या समाप्ति तिथि बदलें।

Ayrshare के माध्यम से बनाया गया Google Ads अभियान शुरू करें या रोकें, उसका नाम बदलें, या उसका दैनिक बजट या समाप्ति तिथि बदलें।

<ul>
  <li>कम से कम एक फ़ील्ड भेजें। एक अनुरोध के सभी बदलाव या तो एक साथ लागू होते हैं या बिल्कुल नहीं।</li>
  <li>अभियान बनाने के बाद आप `type`, `accountId` या `euPoliticalAdvertising` नहीं बदल सकते।</li>
  <li>`Idempotency-Key` की ज़रूरत नहीं है: वही बदलाव दोबारा भेजने पर वही मान सेट होते हैं।</li>
  <li>रिस्पॉन्स अभियान का `campaignStatus` लौटाता है। अन्य फ़ील्ड पढ़ने के लिए [अभियान प्राप्त करें](https://www.ayrshare.com/docs/apis/ads/google/get-campaign.md) का उपयोग करें।</li>
</ul>

## हेडर पैरामीटर

**Authorization** `string` *required*

[API Key](https://www.ayrshare.com/docs/apis/overview.md#authorization) of the Primary Profile.

Format: `Authorization: Bearer API_KEY`
**Profile-Key** `string`

[Profile Key](https://www.ayrshare.com/docs/apis/overview.md#profile-key-format) of a User Profile.

Format: `Profile-Key: PROFILE_KEY`

## पाथ पैरामीटर

**id** `string` *required*

अभियान बनाते समय लौटाया गया `campaignId`।

## बॉडी पैरामीटर

**status** `string`

`active` या `paused`। जब Ayrshare ने Google पर विज्ञापन रोक रखे हों, तब केवल `status: "paused"` भेजने वाला अनुरोध ब्लॉक नहीं होता।

**name** `string`

अभियान का नया नाम, 1 से 255 वर्ण, बिना लाइन ब्रेक के।

**budget** `object`

`{ "amount": number }`: प्रति दिन खर्च की जाने वाली नई राशि, विज्ञापन खाते की मुद्रा में, अधिकतम दो दशमलव स्थानों तक। जिस अभियान का बजट आपने Google Ads में अन्य अभियानों के साथ साझा किया है, वह `code: 101` लौटाता है: साझा बजट को Google Ads में बदलें।

**schedule** `object`

`{ "end": string }`: नई समाप्ति तिथि, ISO तिथि (`2026-11-30`) या तिथि-समय के रूप में। Google विज्ञापन खाते के समय क्षेत्र में पूरे दिन शेड्यूल करता है, इसलिए अभियान उस दिन 23:59:59 पर रुकता है। यह शुरुआत वाला दिन हो सकता है, लेकिन उससे पहले का दिन नहीं।

## त्रुटियाँ

| कोड | कब |
| - | - |
| `101` | कोई फ़ील्ड नहीं भेजा गया, कोई फ़ील्ड अमान्य है, या बजट अन्य अभियानों के साथ साझा है। `details` बताता है कि कौन-सा। |
| `205` | Google ने बदलाव अस्वीकार कर दिया। `details` बताता है कि क्या बदलना है। |
| `400` | अभियान आपका नहीं है, मौजूद नहीं है, या Google Ads में हटा दिया गया था। तब भी, जब आपके द्वारा लिंक किया गया Google यूज़र विज्ञापन खाते तक नहीं पहुँच सकता, या Google Ads एक्सेस रद्द कर दिया गया था। |
| `370` | Google अनुरोध पूरा नहीं कर सका। फिर से प्रयास करें। |

```bash cURL theme={"system"}
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X PUT https://api.ayrshare.com/api/ads/google/campaigns/21534567890 \
-d '{"status": "active", "budget": { "amount": 30 }}'
```

```javascript JavaScript theme={"system"}
const API_KEY = "API_KEY";

fetch("https://api.ayrshare.com/api/ads/google/campaigns/21534567890", {
  method: "PUT",
  headers: {
    "Authorization": `Bearer ${API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({"status": "active", "budget": { "amount": 30 }})
})
  .then((res) => res.json())
  .then((json) => console.log(json))
  .catch(console.error);
```

```python Python theme={"system"}
import requests

headers = {
    "Authorization": "Bearer API_KEY",
}

payload = {"status": "active", "budget": { "amount": 30 }}

r = requests.put("https://api.ayrshare.com/api/ads/google/campaigns/21534567890", headers=headers, json=payload)

print(r.json())
```

```php PHP theme={"system"}
<?php
$payload = <<<'JSON'
{"status": "active", "budget": { "amount": 30 }}
JSON;

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => "https://api.ayrshare.com/api/ads/google/campaigns/21534567890",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer API_KEY",
        "Content-Type: application/json"
    ],
    CURLOPT_POSTFIELDS => $payload
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error: " . $err;
} else {
    echo $response;
}
?>
```

```csharp C# theme={"system"}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        var client = new HttpClient();
        client.DefaultRequestHeaders.Add("Authorization", "Bearer API_KEY");

        var payload = """
            {"status": "active", "budget": { "amount": 30 }}
            """;

        var response = await client.PutAsync(
            "https://api.ayrshare.com/api/ads/google/campaigns/21534567890",
            new StringContent(payload, Encoding.UTF8, "application/json"));
        var content = await response.Content.ReadAsStringAsync();

        Console.WriteLine(content);
    }
}
```

```go Go theme={"system"}
package main

import (
    "fmt"
    "io"
    "net/http"
    "strings"
)

func main() {
    payload := `{"status": "active", "budget": { "amount": 30 }}`

    req, _ := http.NewRequest("PUT", "https://api.ayrshare.com/api/ads/google/campaigns/21534567890", strings.NewReader(payload))
    req.Header.Add("Authorization", "Bearer API_KEY")
    req.Header.Add("Content-Type", "application/json")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        fmt.Println("Error:", err)
        return
    }
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}
```

```java Java theme={"system"}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class UpdateCampaign {
    public static void main(String[] args) throws Exception {
        String payload = """
            {"status": "active", "budget": { "amount": 30 }}
            """;

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.ayrshare.com/api/ads/google/campaigns/21534567890"))
            .header("Authorization", "Bearer API_KEY")
            .header("Content-Type", "application/json")
            .PUT(HttpRequest.BodyPublishers.ofString(payload))
            .build();

        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
```

```ruby Ruby theme={"system"}
require 'net/http'
require 'uri'

uri = URI.parse('https://api.ayrshare.com/api/ads/google/campaigns/21534567890')

request = Net::HTTP::Put.new(uri)
request['Authorization'] = 'Bearer API_KEY'
request['Content-Type'] = 'application/json'
request.body = <<~JSON
  {"status": "active", "budget": { "amount": 30 }}
JSON

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts response.body
```

```json 200: Success theme={"system"}
{
  "status": "success",
  "platform": "google",
  "campaignId": "21534567890",
  "campaignStatus": "active"
}
```

```json 400: Shared Budget theme={"system"}
{
  "action": "request",
  "status": "error",
  "code": 101,
  "message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
  "details": "This campaign uses a budget shared with other campaigns in Google Ads. Change the shared budget in Google Ads."
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.