# How to Upload an Image Using Photo API

Source: https://dev.arcxp.com/photo-center/developer-docs/how-to-upload-an-image-using-photo-api/

Here are different examples to upload a new photo using Photo API

## Summary

Here are different examples to upload a new photo using Photo API

## Procedure

### 1: Arc XP Native Specification (ANS) from file, no ID

```
curl --request POST \
  --url https://api.{{org}}.arcpublishing.com/photo/api/v2/photos \
  --header 'Authorization: Bearer ' \
  --header 'Content-Type: multipart/form-data' \
  --form ans=@/Users/test/Documents/photo_ans_test.json
```

### 2: ANS from file, ID in ANS, no ID in URL path

```
curl --request POST \
  --url https://api.{{org}}.arcpublishing.com/photo/api/v2/photos \
  --header 'Authorization: Bearer ' \
  --header 'Content-Type: multipart/form-data' \
  --form ans=@/Users/test/Documents/photo_ans_test2.json
```

### 3: ANS from file, ID in ANS, ID in URL path

```
curl --request POST \
  --url https://api.{{org}}.arcpublishing.com/photo/api/v2/photos/B3BTTESTNAWNYEUP2VOBDINLPI \
  --header 'Authorization: Bearer ' \
  --header 'Content-Type: multipart/form-data' \
  --form ans=@/Users/test/Documents/photo_ans_test3.json
```

### 4: ANS from JSON, ID in ANS, ID in URL path

```
curl --request POST \
  --url 'https://api.{{org}}.arcpublishing.com/photo/api/v2/photos/B4BTTESTNAWNYEUP2VOBDINLPI?=' \
  --header 'Authorization: Bearer ' \
  --header 'Content-Type: application/json' \
  --data '{
    "_id": "B4BTTESTNAWNYEUP2VOBDINLPI",
    "version": "0.10.7",
    "type": "image",
    "owner": {
        "id": "{{org}}"
    },
    "additional_properties": {
        "originalUrl": "https://images.unsplash.com/photo-1654452698901-cf57845dd7a7"
   }
}'
```

### 5: ANS from JSON, no ID in ANS

```
curl --request POST \
  --url 'https://api.{{org}}.arcpublishing.com/photo/api/v2/photos?=' \
  --header 'Authorization: Bearer ' \
  --header 'Content-Type: application/json' \
  --data '{
    "version": "0.10.7",
    "type": "image",
    "owner": {
        "id": "{{org}}"
    },
    "additional_properties": {
        "originalUrl": "https://images.unsplash.com/photo-1654452698901-cf57845dd7a7"
   }
}'
```

## More Information

- [Photo API Documentation](https://dev.arcxp.com/api/content-administration/photo-api/)
- [How To Write the Minimum ANS for a Viable Image Document](https://dev.arcxp.com/concepts/content-model-ans/minimum-ans-for-a-viable-image-document/)
