

# PutThirdPartyCost

Adds or updates a seller-declared third-party (non-AWS) monthly cost for an app. Omit the cost identifier to create a new cost, or supply an existing cost identifier to update it in place. The amount is a flat monthly value, and currency defaults to USD when omitted.

## Request Syntax
<a name="API_PutThirdPartyCost_RequestSyntax"></a>

```
POST /apps/{{appId}}/third-party-cost HTTP/1.1
Content-type: application/json

{
   "amount": "{{string}}",
   "clientToken": "{{string}}",
   "costId": "{{string}}",
   "currency": "{{string}}",
   "description": "{{string}}",
   "effectiveFrom": "{{string}}",
   "effectiveTo": "{{string}}",
   "frequency": "{{string}}",
   "label": "{{string}}"
}
```

## URI Request Parameters
<a name="API_PutThirdPartyCost_RequestParameters"></a>

The request uses the following URI parameters.

 ** [appId](#API_PutThirdPartyCost_RequestSyntax) **   <a name="appmonetization-PutThirdPartyCost-request-uri-appId"></a>
The ID of the app the cost belongs to.  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Pattern: `[A-Za-z0-9_-]+`   
Required: Yes

## Request Body
<a name="API_PutThirdPartyCost_RequestBody"></a>

The request accepts the following data in JSON format.

 ** [amount](#API_PutThirdPartyCost_RequestSyntax) **   <a name="appmonetization-PutThirdPartyCost-request-amount"></a>
A flat monthly amount as a decimal string (for example, "12.50").  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 32.  
Pattern: `-?[0-9]+(\.[0-9]+)?`   
Required: Yes

 ** [clientToken](#API_PutThirdPartyCost_RequestSyntax) **   <a name="appmonetization-PutThirdPartyCost-request-clientToken"></a>
AWS App Monetization does not use this value for this operation. To retry without creating a duplicate cost, pass the `costId` returned by the first call.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `[!-~]+`   
Required: No

 ** [costId](#API_PutThirdPartyCost_RequestSyntax) **   <a name="appmonetization-PutThirdPartyCost-request-costId"></a>
The ID of the cost. Omit it to create a new cost, or supply an existing cost ID to update that cost in place.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Pattern: `[0-9a-z]{1,64}`   
Required: No

 ** [currency](#API_PutThirdPartyCost_RequestSyntax) **   <a name="appmonetization-PutThirdPartyCost-request-currency"></a>
The currency of the amount. Defaults to USD when omitted (USD is the only supported currency).  
Type: String  
Valid Values: `USD`   
Required: No

 ** [description](#API_PutThirdPartyCost_RequestSyntax) **   <a name="appmonetization-PutThirdPartyCost-request-description"></a>
A free-form description of the cost.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 512.  
Required: No

 ** [effectiveFrom](#API_PutThirdPartyCost_RequestSyntax) **   <a name="appmonetization-PutThirdPartyCost-request-effectiveFrom"></a>
First month (YYYY-MM) the cost applies in. Absent means the cost has no start month.  
Type: String  
Length Constraints: Fixed length of 7.  
Pattern: `\d{4}-(0[1-9]|1[0-2])`   
Required: No

 ** [effectiveTo](#API_PutThirdPartyCost_RequestSyntax) **   <a name="appmonetization-PutThirdPartyCost-request-effectiveTo"></a>
Last month (YYYY-MM) the cost applies in. Absent means the cost has no end month. When both are present, effectiveFrom must not be after effectiveTo.  
Type: String  
Length Constraints: Fixed length of 7.  
Pattern: `\d{4}-(0[1-9]|1[0-2])`   
Required: No

 ** [frequency](#API_PutThirdPartyCost_RequestSyntax) **   <a name="appmonetization-PutThirdPartyCost-request-frequency"></a>
How often the cost recurs. MONTHLY is the only value today.  
Type: String  
Valid Values: `MONTHLY`   
Required: No

 ** [label](#API_PutThirdPartyCost_RequestSyntax) **   <a name="appmonetization-PutThirdPartyCost-request-label"></a>
A human-readable label for the cost (for example, "Anthropic API").  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Required: Yes

## Response Syntax
<a name="API_PutThirdPartyCost_ResponseSyntax"></a>

```
HTTP/1.1 200
Content-type: application/json

{
   "item": { 
      "amount": "string",
      "appId": "string",
      "costId": "string",
      "createdAt": number,
      "currency": "string",
      "description": "string",
      "effectiveFrom": "string",
      "effectiveTo": "string",
      "frequency": "string",
      "label": "string",
      "updatedAt": number
   }
}
```

## Response Elements
<a name="API_PutThirdPartyCost_ResponseElements"></a>

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [item](#API_PutThirdPartyCost_ResponseSyntax) **   <a name="appmonetization-PutThirdPartyCost-response-item"></a>
The third-party cost that was created or updated.  
Type: [ThirdPartyCostItem](API_ThirdPartyCostItem.md) object

## Errors
<a name="API_PutThirdPartyCost_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The caller does not have sufficient permission to perform this action.    
 ** message **   
Human-readable description of the access-denied condition.
HTTP Status Code: 403

 ** ConflictException **   
The request conflicts with the current state of the resource, such as a duplicate identifier or a version mismatch. Retrieve the current state of the resource and retry the request.    
 ** message **   
Human-readable description of the conflict.  
 ** resourceId **   
Identifier of the resource in a conflicting state.  
 ** resourceType **   
Type of the resource in a conflicting state.
HTTP Status Code: 409

 ** InternalServerException **   
An unexpected error occurred while processing the request.    
 ** message **   
Human-readable description of the server error.  
 ** retryAfterSeconds **   
Advice to clients on when the call can be safely retried.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The referenced resource does not exist.    
 ** message **   
Human-readable description of the missing resource.  
 ** resourceId **   
Identifier of the resource that was not found.  
 ** resourceType **   
Type of the resource that was not found (for example, "App" or "Plan").
HTTP Status Code: 404

 ** ThrottlingException **   
The request was denied due to request throttling.    
 ** message **   
Human-readable description of the throttling condition.  
 ** quotaCode **   
Service Quotas identifier for the throttled quota.  
 ** retryAfterSeconds **   
Advice to clients on when the call can be safely retried.  
 ** serviceCode **   
Service Quotas identifier for the originating service.
HTTP Status Code: 429

 ** ValidationException **   
The request failed input validation.    
 ** fieldList **   
The specific input fields that failed validation, when applicable.  
 ** message **   
Human-readable description of what failed validation.  
 ** reason **   
Machine-readable reason the request failed validation, so callers act without parsing the message.
HTTP Status Code: 400

## See Also
<a name="API_PutThirdPartyCost_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/appmonetization-2022-07-26/PutThirdPartyCost) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/appmonetization-2022-07-26/PutThirdPartyCost) 
+  [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/appmonetization-2022-07-26/PutThirdPartyCost) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/appmonetization-2022-07-26/PutThirdPartyCost) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/appmonetization-2022-07-26/PutThirdPartyCost) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/appmonetization-2022-07-26/PutThirdPartyCost) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/appmonetization-2022-07-26/PutThirdPartyCost) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/appmonetization-2022-07-26/PutThirdPartyCost) 
+  [AWS SDK for Python (Boto3)](https://docs.aws.amazon.com/goto/boto3/appmonetization-2022-07-26/PutThirdPartyCost) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/appmonetization-2022-07-26/PutThirdPartyCost) 