> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://es.megaport.ferndocs.com/es/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://es.megaport.ferndocs.com/es/_mcp/server.

# Establecer Mercado de Facturación

POST https://api.megaport.com/v2/market
Content-Type: application/json

Configura el mercado de facturación (y la moneda) y los detalles de contacto de facturación.

Proporcione valores para estos atributos en el cuerpo de la llamada:

*   `currencyEnum` - La moneda de facturación para este mercado. Las monedas varían para cada mercado de facturación. En la mayoría de los mercados, el dólar estadounidense (USD) está disponible como moneda secundaria. Por ejemplo, el mercado de facturación de Singapur ofrece la opción de facturar en dólares de Singapur (SGD) y USD. Una vez que haya elegido una moneda, no se puede cambiar. Los valores de moneda incluyen USD, AUD, CAD, EUR, HKD, JPY, NZD, SGD, SEK, CHF y GBP.
*   `language` - Código de idioma de dos letras para indicar el idioma de facturación, que actualmente se maneja en inglés con un valor de `en`.
*   Detalles de contacto de facturación - El nombre, teléfono, dirección de correo electrónico, dirección física y país del contacto de facturación.
*   `yourPoNumber` - Un número de pedido de compra opcional para seguimiento. Este número es opcional y aparece en todas las facturas relacionadas con su mercado.
*   `taxNumber` - El número de impuestos o IVA según lo requiera la región.
*   `firstPartyId` - ID para el mercado de facturación. Esta tabla muestra los valores.
    
    | País | ID |
    | --- | --- |
    | US | 1558 |
    | AU | 808 |
    | AT | 20442 |
    | BE | 20449 |
    | BG | 4640 |
    | CA | 1652 |
    | CH | 8299 |
    | DE | 4515 |
    | DK | 20447 |
    | ES | 30369 |
    | FI | 20440 |
    | FR | 20451 |
    | HK | 819 |
    | IE | 2683 |
    | IT | 30367 |
    | JP | 20453 |
    | LU | 30423 |
    | NL | 2685 |
    | NO | 20438 |
    | NZ | 855 |
    | PL | 20444 |
    | SE | 2681 |
    | SG | 817 |
    | UK | 2675 |
    

#### Mercado de Facturación de México

Estos atributos son necesarios para el mercado de facturación de México:

*   `companyTypeMexico` - El tipo de identificación fiscal legal del contribuyente (empresa (Entidad legal), persona física (Persona legal) o empresa extranjera). Una empresa o persona física es el contribuyente registrado en el Registro Federal de Contribuyentes de México. Una empresa extranjera es un negocio o persona no registrada en el Servicio de Administración Tributaria (SAT) mexicano. Los valores válidos para este campo son `01: Entidad Legal`, `02: persona legal` y `03: empresa extranjera`.
*   `taxRegimeCodeMexico` - El código de Régimen Fiscal registrado en el Servicio de Administración Tributaria (SAT) mexicano.
*   `satPurposeMexico` - Se relaciona con el uso de la factura electrónica de impuestos (CFDI) que se emitirá al contribuyente que recibe la factura. Utilice este campo para registrar la actividad económica en la factura electrónica que se informará al Servicio de Administración Tributaria (SAT) mexicano.
*   `rfcMexico` - El número de Registro Federal de Contribuyentes emitido por el Servicio de Administración Tributaria (SAT) mexicano. Un número RFC se asigna a cada contribuyente (entidad legal o persona) que realiza una actividad económica en México.
    

**Nota:**

*   Los valores válidos para `taxRegimeCodeMexico`, `satPurposeMexico` y `rfcMexico` varían según el tipo de empresa seleccionado. Para obtener más información sobre todos los valores válidos, consulte la página de Mercados de Facturación de Empresas en el Portal de Megaport, donde se muestran estos campos para el mercado de facturación de México.
    

Para obtener más información, consulte [Habilitación de Mercados de Facturación](https://docs.megaport.com/finance/enabling-market/).

Reference: https://es.megaport.ferndocs.com/es/api-reference/account-setup/set-billing-market

## Servers

- `https://api.megaport.com` (Entorno de producción, default)
- `https://api-staging.megaport.com` (Entorno de pruebas (solo pruebas, se restablece cada 24 horas))

## Request

### Body (application/json)

This endpoint expects an object.

- `address1` (string, optional)
- `address2` (any, optional, nullable)
- `billingContactEmail` (string, optional)
- `billingContactName` (string, optional)
- `billingContactPhone` (string, optional)
- `city` (string, optional)
- `country` (string, optional)
- `currencyEnum` (string, optional)
- `firstPartyId` (double, optional)
- `language` (string, optional)
- `postcode` (string, optional)
- `state` (string, optional)
- `taxNumber` (any, optional, nullable)
- `yourPoNumber` (any, optional, nullable)

## Response

### 201

Establecer Mercado de Facturación / Establecer Mercado de Facturación

- `data` (V2MarketPostResponsesContentApplicationJsonSchemaData, optional)
- `message` (string, optional)
- `terms` (string, optional)

## Types

### V2MarketPostResponsesContentApplicationJsonSchemaData

- `supplyId` (double, optional)

## Examples

**Request**

```json
{
  "address1": "1 Test Street",
  "address2": null,
  "billingContactEmail": "market@megaport.com",
  "billingContactName": "Market Contact",
  "billingContactPhone": "+61 7 12341234",
  "city": "Somewhere",
  "country": "AU",
  "currencyEnum": "AUD",
  "firstPartyId": 808,
  "language": "en",
  "postcode": "4000",
  "state": "Anywhere",
  "taxNumber": null,
  "yourPoNumber": null
}
```

**Response**

```json
{
  "data": {
    "supplyId": 5987
  },
  "message": "Mercado Creado",
  "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}
```

**SDK Code**

```python
import requests

url = "https://api.megaport.com/v2/market"

payload = {
    "address1": "1 Test Street",
    "address2": None,
    "billingContactEmail": "market@megaport.com",
    "billingContactName": "Market Contact",
    "billingContactPhone": "+61 7 12341234",
    "city": "Somewhere",
    "country": "AU",
    "currencyEnum": "AUD",
    "firstPartyId": 808,
    "language": "en",
    "postcode": "4000",
    "state": "Anywhere",
    "taxNumber": None,
    "yourPoNumber": None
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.megaport.com/v2/market';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"address1":"1 Test Street","address2":null,"billingContactEmail":"market@megaport.com","billingContactName":"Market Contact","billingContactPhone":"+61 7 12341234","city":"Somewhere","country":"AU","currencyEnum":"AUD","firstPartyId":808,"language":"en","postcode":"4000","state":"Anywhere","taxNumber":null,"yourPoNumber":null}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api.megaport.com/v2/market"

	payload := strings.NewReader("{\n  \"address1\": \"1 Test Street\",\n  \"address2\": null,\n  \"billingContactEmail\": \"market@megaport.com\",\n  \"billingContactName\": \"Market Contact\",\n  \"billingContactPhone\": \"+61 7 12341234\",\n  \"city\": \"Somewhere\",\n  \"country\": \"AU\",\n  \"currencyEnum\": \"AUD\",\n  \"firstPartyId\": 808,\n  \"language\": \"en\",\n  \"postcode\": \"4000\",\n  \"state\": \"Anywhere\",\n  \"taxNumber\": null,\n  \"yourPoNumber\": null\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.megaport.com/v2/market")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"address1\": \"1 Test Street\",\n  \"address2\": null,\n  \"billingContactEmail\": \"market@megaport.com\",\n  \"billingContactName\": \"Market Contact\",\n  \"billingContactPhone\": \"+61 7 12341234\",\n  \"city\": \"Somewhere\",\n  \"country\": \"AU\",\n  \"currencyEnum\": \"AUD\",\n  \"firstPartyId\": 808,\n  \"language\": \"en\",\n  \"postcode\": \"4000\",\n  \"state\": \"Anywhere\",\n  \"taxNumber\": null,\n  \"yourPoNumber\": null\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.megaport.com/v2/market")
  .header("Content-Type", "application/json")
  .body("{\n  \"address1\": \"1 Test Street\",\n  \"address2\": null,\n  \"billingContactEmail\": \"market@megaport.com\",\n  \"billingContactName\": \"Market Contact\",\n  \"billingContactPhone\": \"+61 7 12341234\",\n  \"city\": \"Somewhere\",\n  \"country\": \"AU\",\n  \"currencyEnum\": \"AUD\",\n  \"firstPartyId\": 808,\n  \"language\": \"en\",\n  \"postcode\": \"4000\",\n  \"state\": \"Anywhere\",\n  \"taxNumber\": null,\n  \"yourPoNumber\": null\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.megaport.com/v2/market', [
  'body' => '{
  "address1": "1 Test Street",
  "address2": null,
  "billingContactEmail": "market@megaport.com",
  "billingContactName": "Market Contact",
  "billingContactPhone": "+61 7 12341234",
  "city": "Somewhere",
  "country": "AU",
  "currencyEnum": "AUD",
  "firstPartyId": 808,
  "language": "en",
  "postcode": "4000",
  "state": "Anywhere",
  "taxNumber": null,
  "yourPoNumber": null
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.megaport.com/v2/market");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"address1\": \"1 Test Street\",\n  \"address2\": null,\n  \"billingContactEmail\": \"market@megaport.com\",\n  \"billingContactName\": \"Market Contact\",\n  \"billingContactPhone\": \"+61 7 12341234\",\n  \"city\": \"Somewhere\",\n  \"country\": \"AU\",\n  \"currencyEnum\": \"AUD\",\n  \"firstPartyId\": 808,\n  \"language\": \"en\",\n  \"postcode\": \"4000\",\n  \"state\": \"Anywhere\",\n  \"taxNumber\": null,\n  \"yourPoNumber\": null\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "address1": "1 Test Street",
  "address2": ,
  "billingContactEmail": "market@megaport.com",
  "billingContactName": "Market Contact",
  "billingContactPhone": "+61 7 12341234",
  "city": "Somewhere",
  "country": "AU",
  "currencyEnum": "AUD",
  "firstPartyId": 808,
  "language": "en",
  "postcode": "4000",
  "state": "Anywhere",
  "taxNumber": ,
  "yourPoNumber": 
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.megaport.com/v2/market")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```