POST
/
anti-fraud-services
New anti-fraud service
package main

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

func main() {

	url := "https://api.sandbox.{id}.gr4vy.app/anti-fraud-services"

	payload := strings.NewReader("{\n  \"anti_fraud_service_definition_id\": \"sift-anti-fraud\",\n  \"display_name\": \"Sift Anti-Fraud Service.\",\n  \"fields\": [\n    {\n      \"key\": \"api_key\",\n      \"value\": \"sk_test_26PHem9AhJZvU623DfE1x4sd\"\n    },\n    {\n      \"key\": \"account_id\",\n      \"value\": \"26PHem9AhJZvU623DfE1x4sd\"\n    }\n  ]\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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))

}
{
  "type": "anti-fraud-service",
  "id": "fe26475d-ec3e-4884-9553-f7356683f7f9",
  "merchant_account_id": "default",
  "anti_fraud_service_definition_id": "sift-anti-fraud",
  "display_name": "Sift Anti-Fraud Service.",
  "active": true,
  "reviews_enabled": false,
  "fields": [
    {
      "key": "approve_decision",
      "value": "sk_test_26PHem9AhJZvU623DfE1x4sd"
    }
  ],
  "created_at": "2013-07-16T19:23:00.000+00:00",
  "updated_at": "2013-07-16T19:23:00.000+00:00"
}
This endpoint requires the anti-fraud-services.write scope.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

A request to create an anti-fraud service. A request to update an anti-fraud service.

anti_fraud_service_definition_id
enum<string>
required

The name of the Anti-Fraud service provider. During update request, this value is used for validation only but the underlying service can not be changed for an existing service.

Available options:
cybersource-anti-fraud,
forter-anti-fraud,
sift-anti-fraud
Example:

"sift-anti-fraud"

display_name
string
required

A unique name for this anti-fraud service which is used in the Gr4vy admin panel to give a anti-fraud Service a human readable name.

Required string length: 1 - 200
Example:

"Sift Anti-Fraud Service."

fields
object[]
required

A list of fields, each containing a key-value pair for each field defined by the definition for this anti-fraud service e.g. for Sift api_key must be sent within this field when creating the service.

For updates, only the fields sent here will be updated, existing ones will not be affected if not present.

active
boolean
default:true

Defines if this service is currently active or not. There can only be one active service at any time. When updating a service to active, the current active service will be deactivated.

Example:

true

reviews_enabled
boolean
default:false

Defines if this service needs to handle the review status from anti-fraud responses with a proper review workflow. If not, the review status will be treated as any other one.

Example:

false

Response

Returns the anti-fraud service that was added.

type
enum<string>

The type of this resource. Is always anti-fraud-service.

Available options:
anti-fraud-service
Example:

"anti-fraud-service"

id
string<uuid>

The unique Gr4vy ID for this anti-fraud service.

Example:

"fe26475d-ec3e-4884-9553-f7356683f7f9"

merchant_account_id
string

The unique ID for a merchant account.

Example:

"default"

anti_fraud_service_definition_id
enum<string>

The name of the Anti-Fraud service provider. During update request, this value is used for validation only but the underlying service can not be changed for an existing service.

Available options:
cybersource-anti-fraud,
forter-anti-fraud,
sift-anti-fraud
Example:

"sift-anti-fraud"

display_name
string | null

A unique name for this anti-fraud service which is used in the Gr4vy admin panel to give a anti-fraud service a human readable name.

Required string length: 1 - 200
Example:

"Sift Anti-Fraud Service."

active
boolean
default:true

Defines if this service is currently active or not.

Example:

true

reviews_enabled
boolean
default:false

Defines if this service needs to handle the review status with a proper review workflow. If not, the review status will be treated as any other one.

Example:

false

fields
object[]

A list of fields, each containing a key-value pair for anti-fraud service decision mapping e.g. for Sift approve_decision will be in the response.

created_at
string<date-time>

The date and time when this anti-fraud service was created in our system.

Example:

"2013-07-16T19:23:00.000+00:00"

updated_at
string<date-time>

The date and time when this anti-fraud service was last updated in our system.

Example:

"2013-07-16T19:23:00.000+00:00"